Skip to content

Commit 0ad5eb8

Browse files
Update org-html-footnote-section snippet to Org 9.7.34
1 parent 097ffca commit 0ad5eb8

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

ox-html-markdown-style-footnotes.org

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ This results in footnotes with support for multiple paragraphs, that work withou
109109

110110
* Implementation
111111

112-
In [[https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox-html.el?h=release_9.6.5#n1858][Org mode 9.6.5]], the ~org-html-footnote-section~ looks like this:
112+
In [[https://cgit.git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox-html.el?h=release_9.7.34#n1870][Org mode 9.7.34]] the ~org-html-footnote-section~ looks like this:
113113

114114
#+headers: :noweb yes
115115
#+begin_src emacs-lisp
@@ -127,7 +127,7 @@ In [[https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox-html.el?h
127127
(mapconcat
128128
(lambda (definition)
129129
(pcase definition
130-
(`(,n ,_ ,def)
130+
(`(,n ,label ,def)
131131
<<footnote-definitions>>)))
132132
definitions
133133
"\n"))))))
@@ -138,12 +138,24 @@ The interesting part is executed for each footnote, and wraps each footnote in a
138138

139139
#+name: footnote-definitions
140140
#+begin_src emacs-lisp
141+
;; Do not assign number labels as they appear in Org mode
142+
;; - the footnotes are re-numbered by
143+
;; `org-export-get-footnote-number'. If the label is not
144+
;; a number, keep it.
145+
(when (and (stringp label)
146+
(equal label (number-to-string (string-to-number label))))
147+
(setq label nil))
148+
;; `org-export-collect-footnote-definitions' can return
149+
;; two kinds of footnote definitions: inline and blocks.
150+
;; Since this should not make any difference in the HTML
151+
;; output, we wrap the inline definitions within
152+
;; a "footpara" class paragraph.
141153
(let ((inline? (not (org-element-map def org-element-all-elements
142154
#'identity nil t)))
143155
(anchor (org-html--anchor
144-
(format "fn.%d" n)
156+
(format "fn.%s" (or label n))
145157
n
146-
(format " class=\"footnum\" href=\"#fnr.%d\" role=\"doc-backlink\"" n)
158+
(format " class=\"footnum\" href=\"#fnr.%s\" role=\"doc-backlink\"" (or label n))
147159
info))
148160
(contents (org-trim (org-export-data def info))))
149161
(format "<div class=\"footdef\">%s %s</div>\n"

0 commit comments

Comments
 (0)