Dear maintainer,

I have an Org file with contents like the following:

    This is a test 1 [fn:n24aa:These are the contents] and here is more.

When I do an HTML export, the footnote's label (n24aa) is not preserved
in the exported HTML. Is this intended behaviour? I was expecting it to
keep the label as a user-defined unique identifier.

I looked into the ox.el and noticed that the export data does include
the labels. But 'org-html-footnote-reference' does not have a call to
get the label: it assigns a number outright. To experiment with
retrieving the data, I tried this:

    ;; PROOF-OF-CONCEPT that works for footnote references but not
    ;; footnote definitions
    (defun org-export-get-footnote-label (footnote)
      (org-element-property :label footnote))

    (defun org-html-footnote-reference (footnote-reference _contents info)
      "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
    CONTENTS is nil.  INFO is a plist holding contextual information."
       ;; Insert separator between two footnotes in a row.
       (let ((prev (org-export-get-previous-element footnote-reference info)))
         (when (eq (org-element-type prev) 'footnote-reference)
           (plist-get info :html-footnote-separator)))
       (let* ((n (or
                  (org-export-get-footnote-label footnote-reference)
                  (org-export-get-footnote-number footnote-reference info)))
              (id (format "fnr.%s%s"
                          (if (org-export-footnote-first-reference-p
                               footnote-reference info)
          (plist-get info :html-footnote-format)
           id n (format " class=\"footref\" href=\"#fn.%s\" 
role=\"doc-backlink\"" n) info)))))

Can we have footnotes with their label preserved? Or maybe is this going
to break a lot of functionality? I am aware the above not work for
footnote definitions, as those also get the number.

I am happy to keep studying the export infrastructure if you give me
some pointers.

Thank you for your time and for maintaining this wonderful project!

All the best,
Protesilaos (or simply "Prot")

* *  *

Emacs  : GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, 
cairo version 1.16.0)
 of 2024-04-03
Package: Org mode version 9.6.15 (release_9.6.15 @ 

Protesilaos Stavrou

Reply via email to