From mboxrd@z Thu Jan 1 00:00:00 1970 From: tftorrey@tftorrey.com (T.F. Torrey) Subject: Re: Bug: HTML export ignoring CUSTOM_ID properties Date: Fri, 17 Apr 2015 11:20:12 -0700 Message-ID: <87twwefwgz.fsf@jack.tftorrey.com> References: <87lhhrr4es.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjAsM-0004VD-A8 for emacs-orgmode@gnu.org; Fri, 17 Apr 2015 14:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YjAsH-00047A-4P for emacs-orgmode@gnu.org; Fri, 17 Apr 2015 14:20:26 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:48370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjAsG-000473-RK for emacs-orgmode@gnu.org; Fri, 17 Apr 2015 14:20:21 -0400 In-Reply-To: <87lhhrr4es.fsf@gmx.us> (message from Rasmus on Fri, 17 Apr 2015 02:20:59 +0200) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org 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 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": > >

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

1 Favorite Presidents

1.1 George Washington

He was tall.

1.2 Bill Clinton

He liked the ladies.

#+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