org-html-footnote-reference: Fix duplicate IDs

* lisp/ox-html.el (org-html-footnote-reference): When multiple
footnote references point to a single footnote, make sure that the
reference ids are not duplicated.  Now, the ids for non-first
reference are constructed as fn.<footnote id>.<footnote reference
number>.  The reference number of counted across all the footnote
references referencing the same footnote.

Reported-by: Protesilaos Stavrou <info@protesilaos.com>
Link: https://orgmode.org/list/87cyqcv9q1.fsf@protesilaos.com
This commit is contained in:
Ihor Radchenko 2024-04-28 13:33:35 +03:00
parent 065af4b42a
commit e0f24a3f6d
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 9 additions and 1 deletions

View File

@ -2762,7 +2762,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(if (org-export-footnote-first-reference-p
footnote-reference info)
""
".100"))))
(let ((label (org-element-property :label footnote-reference)))
(format
".%d"
(org-export-get-ordinal
footnote-reference info '(footnote-reference)
`(lambda (ref _)
(if ,label
(equal (org-element-property :label ref) ,label)
(not (org-element-property :label ref)))))))))))
(format
(plist-get info :html-footnote-format)
(org-html--anchor