emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: HTML export ignoring CUSTOM_ID properties


From: T.F. Torrey
Subject: Re: [O] Bug: HTML export ignoring CUSTOM_ID properties
Date: Fri, 17 Apr 2015 11:20:12 -0700

Hi Rasmus,

As someone with all my personal and work files in Org, I sincerely
appreciate all the work you do to improve Org.  But...

Rasmus <address@hidden> writes:

>> With the latest from Git master, the HTML export ignores CUSTOM_ID
>> properties for subtrees.  I've seen list traffic that the names of the
>> export ID's are being changed, but this is not intentional, right?
>
> It doesn't ignore it, but it is translate to a generic anchor as
> needed.

Isn't translating it to a generic anchor the same as ignoring it?
Without a CUSTOM_ID you get a generic anchor.  With a CUSTOM_ID you get
a generic anchor.

> Previously, both a generic anchor and the custom_id would be inserted in
> html.  E.g. for a headline with id "h1":
>
>     <h2 id="h1"><a id="sec-1" name="sec-1"></a>

Yes, that was a little clunky, but it did work, and the name attributes
could be suppressed.

> The problem is that we don't know that h1 is unique.
>
> However, in html custom_id serves as an important measure to facilitate
> css customization, e.g. on a section level-basis.

Yes, the user was responsible for making sure CUSTOM_ID's were unique,
but in practice that never amounted to what could be described as "the"
problem.

However, CUSTOM_ID's are not just CSS targets, they are link targets.

Consider this typical usage:

I have a page of my favorite presidents:

#+BEGIN_SRC org
* Favorite Presidents

** George Washington
:PROPERTIES:
:CUSTOM_ID: washington
:END:

He was tall.

** Bill Clinton
:PROPERTIES:
:CUSTOM_ID: clinton
:END:

He liked the ladies.
#+END_SRC

Because I know (knew) the id of the section about Clinton, I could link
to my page from another document outside Org with a link to
presidents.html#clinton.

This is how all the links between documents are done on my website, and
it's mostly how internal links in the HTML that becomes e-books is done.

However, with the new export code, many, perhaps all, of my links are
broken, because what comes out of the HTML exporter is this:

#+BEGIN_HTML
<div id="outline-container-sec:4" class="outline-2">
<h2 id="sec:4"><span class="section-number-2">1</span> Favorite Presidents</h2>
<div class="outline-text-2" id="text-1">
</div><div id="outline-container-sec:1" class="outline-3">
<h3 id="sec:1"><span class="section-number-3">1.1</span> George Washington</h3>
<div class="outline-text-3" id="text-washington">
<p>
He was tall.
</p>
</div>
</div>

<div id="outline-container-sec:2" class="outline-3">
<h3 id="sec:2"><span class="section-number-3">1.2</span> Bill Clinton</h3>
<div class="outline-text-3" id="text-clinton">
<p>
He liked the ladies.
</p>
</div>
</div>
#+END_HTML

Notice how my CUSTOM_ID's are no longer ID's at all.  And simply adding
"text-" to my CUSTOM_ID's is not an answer.  For one thing, CUSTOM_ID
exports should not change on the breeze of developer whims.  For
another, the ID should be attached to the heading, not the body of the
text; otherwise, a person following the link would have no idea if it
went to the Clinton section or not.

Note that this also breaks any CSS styling for the section with the
CUSTOM_ID (which I also use).  If I used a CUSTOM_ID because wanted a
swanky background for the heading saying "Bill Clinton", the current
export not only doesn't use that ID, it doesn't encompass the heading
with his name in.

> Thus, I think it is a bug, unless there is a better way to allow
> per-section css. I will look at this later unless somebody beets me to it.

Given the lack of outcry, I may be the only one using CUSTOM_ID's for
HTML export.  However, if usage is widespread enough and accidental
duplicates are a problem enough that this needs to be addressed,
wouldn't it be better for the exporter to simply report duplicate ID's
as they are found?

Finally, given that this doesn't appear to work at all in any form of
its intended usage, how did this even get committed to master?  Sure,
code in master may have bugs, but this is more than a bug; this is
unusable code that breaks code that worked.  Shouldn't it be developed
on a feature branch or in someone's private repo until it actually
works?

Unless there is a quick fix that restores external (non-Org-generated)
links to sections with CUSTOM_ID's, please revert these changes until
the development reaches a usable state.

All the best,
Terry
-- 
T.F. Torrey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]