emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] HTML export does not preserve footnote label [9.6.15 (release_


From: Protesilaos Stavrou
Subject: Re: [BUG] HTML export does not preserve footnote label [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/30.0.50/lisp/org/)]
Date: Fri, 26 Apr 2024 10:55:50 +0300

> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Sat, 13 Apr 2024 14:00:48 +0000
>
> Protesilaos Stavrou <info@protesilaos.com> writes:
>
>> With regard to the disambiguation scheme, I am playing around with
>> various scenaria to see how Org HTML export behaves. Using the
>> following:
>> ...
>>     This is test 2 <sup><a id="fnr.1.100" class="footref" href="#fn.1" 
>> role="doc-backlink">1</a></sup>
>> ...
>>     This is test 3 <sup><a id="fnr.1.100" class="footref" href="#fn.1" 
>> role="doc-backlink">1</a></sup>
>>
>> Notice that the 100 in the ID is not incremented further. I guess this
>> is something that can be worked on but, again, I think it is separate
>> from the issue of using the label for the ID and HREF.
>>
>> Any thoughts?
>
> Duplicate IDs are against HTML spec:
> https://softwareengineering.stackexchange.com/questions/127178/two-html-elements-with-same-id-attribute-how-bad-is-it-really
>
> So, this is a bug.

Indeed! We can look into this separately.

>>>> Though I should have clarified my intent earlier: the idea is to use the
>>>> label as a fixed reference to the footnote, so that the link does not
>>>> change between exports. This is the same principle as what we do with
>>>> links to headings that have a CUSTOM_ID.
>>>>
>>>> As such, the anchor text can still be the way it is now as an
>>>> automatically generated number sequence (^1, ^2, etc.), but the HTML
>>>> "id" and "href" values will be constructed based on the label of the
>>>> footnote, NOT its number in the sequence.
>
> See the attached tentative patch.

> [... 144 lines elided]

Thank you! I just tried it. I encountered two problems with it, which I
am addressing with the two attached patches (feel free to modify as
needed). In short:

1. The footnote definitions at the bottom of the file were still using
the ordinal HTML id, which did not correspond to the href with the
label.

2. If the file had a mixture of labeled and anonymous/unlabeled
footnotes, then the export would break as it would be passing a nil
value to 'string-to-number'.

Please let me know how to proceed.

-- 
Protesilaos Stavrou
https://protesilaos.com

Attachment: 0001-Use-the-label-if-present-in-footnote-definition.patch
Description: Text Data

Attachment: 0002-Guard-against-nil-label-value-for-footnotes.patch
Description: Text Data


reply via email to

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