emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ox-html export bug
@ 2017-09-07 17:02 kadal
  2017-09-07 17:32 ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: kadal @ 2017-09-07 17:02 UTC (permalink / raw)
  To: emacs-orgmode

This org file

-------------------------
* heading 1
* heading 2
:PROPERTIES:
:CUSTOM_ID: my-name
:END:

--------------------------------

exports to

-----------------------------------
<div id="outline-container-orgf4e5527" class="outline-2">
<h2 id="orgf4e5527"><span class="section-number-2">1</span> heading 1</h2>
</div>

<div id="outline-container-orge4e91c4" class="outline-2">
<h2 id="my-name"><a id="orge4e91c4"></a><span 
class="section-number-2">2</span> heading 2</h2>

<div class="outline-text-2" id="text-my-name">
</div>
-----------------------------------------------

The "<a id="orge4e91c4"></a>" for the second heading is unnecessary. 
Seems to only occur when CUSTOM_ID is set.

Deepak

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-07 17:02 ox-html export bug kadal
@ 2017-09-07 17:32 ` Nicolas Goaziou
  2017-09-07 18:04   ` kadal
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-09-07 17:32 UTC (permalink / raw)
  To: kadal; +Cc: emacs-orgmode

Hello,

kadal <kadalcalypse@gmail.com> writes:

> This org file
>
> -------------------------
> * heading 1
> * heading 2
> :PROPERTIES:
> :CUSTOM_ID: my-name
> :END:
>
> --------------------------------
>
> exports to
>
> -----------------------------------
> <div id="outline-container-orgf4e5527" class="outline-2">
> <h2 id="orgf4e5527"><span class="section-number-2">1</span> heading 1</h2>
> </div>
>
> <div id="outline-container-orge4e91c4" class="outline-2">
> <h2 id="my-name"><a id="orge4e91c4"></a><span
> class="section-number-2">2</span> heading 2</h2>
>
> <div class="outline-text-2" id="text-my-name">
> </div>
> -----------------------------------------------
>
> The "<a id="orge4e91c4"></a>" for the second heading is unnecessary.
> Seems to only occur when CUSTOM_ID is set.

It is the internal reference for "my-name" custom ID.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-07 17:32 ` Nicolas Goaziou
@ 2017-09-07 18:04   ` kadal
  2017-09-08  8:55     ` Rasmus
  0 siblings, 1 reply; 10+ messages in thread
From: kadal @ 2017-09-07 18:04 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

The problem is that if you have CSS that decorates links by adding 
content after a link, that (empty) link gets decorated too.

Is it possible to remove it? There is no such empty link for the first 
heading which does not have CUSTOM_ID set.

Deepak

On 09/07/2017 10:32 AM, Nicolas Goaziou wrote:
> Hello,
> 
> kadal <kadalcalypse@gmail.com> writes:
> 
>> This org file
>>
>> -------------------------
>> * heading 1
>> * heading 2
>> :PROPERTIES:
>> :CUSTOM_ID: my-name
>> :END:
>>
>> --------------------------------
>>
>> exports to
>>
>> -----------------------------------
>> <div id="outline-container-orgf4e5527" class="outline-2">
>> <h2 id="orgf4e5527"><span class="section-number-2">1</span> heading 1</h2>
>> </div>
>>
>> <div id="outline-container-orge4e91c4" class="outline-2">
>> <h2 id="my-name"><a id="orge4e91c4"></a><span
>> class="section-number-2">2</span> heading 2</h2>
>>
>> <div class="outline-text-2" id="text-my-name">
>> </div>
>> -----------------------------------------------
>>
>> The "<a id="orge4e91c4"></a>" for the second heading is unnecessary.
>> Seems to only occur when CUSTOM_ID is set.
> 
> It is the internal reference for "my-name" custom ID.
> 
> Regards,
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-07 18:04   ` kadal
@ 2017-09-08  8:55     ` Rasmus
  2017-09-08 10:19       ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2017-09-08  8:55 UTC (permalink / raw)
  To: emacs-orgmode

kadal <kadalcalypse@gmail.com> writes:

> The problem is that if you have CSS that decorates links by adding
> content after a link, that (empty) link gets decorated too.

Fair point.  Would it be sufficient to give these type of links a class,
say "org-internal-links".  Then you should be able to explicitly turn off
the content for these links.

    .org-internal-links::after {content:"";}

> Is it possible to remove it?

You could use a filter to remove empty links just after headings.  See
‘org-export-filter-headline-functions’ and ‘org-export-derived-backend-p’.

Rasmus

-- 
Lasciate ogni speranza o voi che entrate: siete nella mani di'machellaio

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-08  8:55     ` Rasmus
@ 2017-09-08 10:19       ` Nicolas Goaziou
  2017-09-08 17:18         ` kadal
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-09-08 10:19 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> kadal <kadalcalypse@gmail.com> writes:
>
>> The problem is that if you have CSS that decorates links by adding
>> content after a link, that (empty) link gets decorated too.
>
> Fair point.  Would it be sufficient to give these type of links a class,
> say "org-internal-links".  Then you should be able to explicitly turn off
> the content for these links.
>
>     .org-internal-links::after {content:"";}

I haven't put much thought into it, but I wonder if it would be possible
to ignore EXTRA-IDS and only use PREFERRED-ID (see `org-html-headline'),
i.e., use

  (or (org-element-property :CUSTOM_ID headline)
      (org-export-get-reference headline info))

It could be a problem when publishing to HTML, but I'm not sure at this
point.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-08 10:19       ` Nicolas Goaziou
@ 2017-09-08 17:18         ` kadal
  2017-09-08 17:32           ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: kadal @ 2017-09-08 17:18 UTC (permalink / raw)
  To: emacs-orgmode


>> Fair point.  Would it be sufficient to give these type of links a class,
>> say "org-internal-links".  Then you should be able to explicitly turn off
>> the content for these links.
>>
>>      .org-internal-links::after {content:"";}

I don't know, looks like a bug to me.

> I haven't put much thought into it, but I wonder if it would be possible
> to ignore EXTRA-IDS and only use PREFERRED-ID (see `org-html-headline'),
> i.e., use
> 
>    (or (org-element-property :CUSTOM_ID headline)
>        (org-export-get-reference headline info))
> 
> It could be a problem when publishing to HTML, but I'm not sure at this
> point.

Going back to the original report:

------------------------------
<div id="outline-container-orgf4e5527" class="outline-2">
<h2 id="orgf4e5527"><span class="section-number-2">1</span> heading 1</h2>
</div>

<div id="outline-container-orge4e91c4" class="outline-2">
<h2 id="my-name"><a id="orge4e91c4"></a><span
class="section-number-2">2</span> heading 2</h2>

<div class="outline-text-2" id="text-my-name">
</div>
-------------------------------

The first headline with no CUSTOM_ID exports to "<h2 id="orgf4e5527">"
The second headline with a CUSTOM_ID exports to "<h2 id="my-name"><a 
id="orge4e91c4"></a>"

Seems like the second one should export to either "<h2 id="my-name">" or 
"<h2 id="my-name" id="orge4e91c4">". Not sure why the empty link is 
being inserted or needs to be there at all.

Deepak

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-08 17:18         ` kadal
@ 2017-09-08 17:32           ` Nicolas Goaziou
  2017-09-08 17:40             ` kadal
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-09-08 17:32 UTC (permalink / raw)
  To: kadal; +Cc: emacs-orgmode

kadal <kadalcalypse@gmail.com> writes:

> Seems like the second one should export to either "<h2 id="my-name">"
> or "<h2 id="my-name" id="orge4e91c4">".

Is it valid HTML?

Regards,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-08 17:32           ` Nicolas Goaziou
@ 2017-09-08 17:40             ` kadal
  2017-09-08 18:52               ` Fabrice Popineau
  0 siblings, 1 reply; 10+ messages in thread
From: kadal @ 2017-09-08 17:40 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

On 09/08/2017 10:32 AM, Nicolas Goaziou wrote:
> kadal <kadalcalypse@gmail.com> writes:
> 
>> Seems like the second one should export to either "<h2 id="my-name">"
>> or "<h2 id="my-name" id="orge4e91c4">".
> 
> Is it valid HTML?
> 
> Regards,
> 
This SO thread has confusing answers: 
https://stackoverflow.com/questions/192048/can-an-html-element-have-multiple-ids#192066

Looks like the second option will work. That said, the first option is 
better because if I'm setting a CUSTOM_ID, that's what should be used 
for internal links...

Deepak

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-08 17:40             ` kadal
@ 2017-09-08 18:52               ` Fabrice Popineau
  2017-09-09 22:37                 ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Fabrice Popineau @ 2017-09-08 18:52 UTC (permalink / raw)
  To: kadal; +Cc: emacs-orgmode@gnu.org, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

2017-09-08 19:40 GMT+02:00 kadal <kadalcalypse@gmail.com>:

> On 09/08/2017 10:32 AM, Nicolas Goaziou wrote:
>
>> kadal <kadalcalypse@gmail.com> writes:
>>
>> Seems like the second one should export to either "<h2 id="my-name">"
>>> or "<h2 id="my-name" id="orge4e91c4">".
>>>
>>
>> Is it valid HTML?
>>
>> Regards,
>>
>> This SO thread has confusing answers: https://stackoverflow.com/ques
> tions/192048/can-an-html-element-have-multiple-ids#192066
>
> Looks like the second option will work.


Not valid according to :

https://www.w3.org/TR/html5/syntax.html#attributes-0

"There must never be two or more attributes on the same start tag whose
names are an ASCII case-insensitive match for each other."


> That said, the first option is better because if I'm setting a CUSTOM_ID,
> that's what should be used for internal links...
>
>
I agree with that. Ideally, if you set a CUSTOM_ID, then it should replace
the default org generated id.

Regards,

Fabrice

[-- Attachment #2: Type: text/html, Size: 2296 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ox-html export bug
  2017-09-08 18:52               ` Fabrice Popineau
@ 2017-09-09 22:37                 ` Nicolas Goaziou
  0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2017-09-09 22:37 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: kadal, emacs-orgmode@gnu.org

Hello,

Fabrice Popineau <fabrice.popineau@gmail.com> writes:

> 2017-09-08 19:40 GMT+02:00 kadal <kadalcalypse@gmail.com>:
>
>> That said, the first option is better because if I'm setting a CUSTOM_ID,
>> that's what should be used for internal links...
>>
>>
> I agree with that. Ideally, if you set a CUSTOM_ID, then it should replace
> the default org generated id.

Using raw CUSTOM_ID value in exported documents is an issue because it
requires the user to know, ahead of time, what are the allowed
characters in the output format. As an example, I would consider it to
be a bug if Org refused to export my document to pdf because I had
chosen "100%" as a custom ID somewhere in the document.

However, HTML is a bit special in this case, because users expect to see
custom ID in the address bar of their browser.

Hopefully this is now fixed.

Thank you.


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-09-09 22:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-07 17:02 ox-html export bug kadal
2017-09-07 17:32 ` Nicolas Goaziou
2017-09-07 18:04   ` kadal
2017-09-08  8:55     ` Rasmus
2017-09-08 10:19       ` Nicolas Goaziou
2017-09-08 17:18         ` kadal
2017-09-08 17:32           ` Nicolas Goaziou
2017-09-08 17:40             ` kadal
2017-09-08 18:52               ` Fabrice Popineau
2017-09-09 22:37                 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).