emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tftorrey@tftorrey.com (T.F. Torrey)
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: HTML export ignoring CUSTOM_ID properties
Date: Fri, 17 Apr 2015 11:20:12 -0700	[thread overview]
Message-ID: <87twwefwgz.fsf@jack.tftorrey.com> (raw)
In-Reply-To: <87lhhrr4es.fsf@gmx.us> (message from Rasmus on Fri, 17 Apr 2015 02:20:59 +0200)

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 <rasmus@gmx.us> 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	other threads:[~2015-04-17 18:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 23:19 Bug: HTML export ignoring CUSTOM_ID properties T.F. Torrey
2015-04-17  0:20 ` Rasmus
2015-04-17 18:20   ` T.F. Torrey [this message]
2015-04-18 13:57     ` Rasmus
2015-04-18 18:26       ` T.F. Torrey
2015-04-18 22:38         ` Aaron Ecay
2015-04-19  3:40           ` T.F. Torrey
2015-04-18 23:08         ` Nicolas Goaziou
2015-04-19  4:20           ` T.F. Torrey
2015-04-19  9:08             ` Nicolas Goaziou
2015-04-19 21:11               ` T.F. Torrey
2015-04-19 14:47             ` Rasmus
2015-04-21  5:37       ` Daniel Clemente
2015-04-21  7:25         ` Nicolas Goaziou
2015-04-23 18:15           ` Daniel Clemente
2015-04-23 19:21             ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twwefwgz.fsf@jack.tftorrey.com \
    --to=tftorrey@tftorrey.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).