contrib/lisp/org-export: Add footnote number to footnotes definitions collection
* contrib/lisp/org-export.el (org-export-collect-footnote-definitions): Change key to footnote number, retrieved with `org-export-get-footnote-number'. Also, do not use beginning position as label for inline footnotes, as those are weak identifiers.
This commit is contained in:
parent
a7afc47572
commit
5136d2ee41
|
@ -2110,14 +2110,11 @@ Point is at buffer's beginning when BODY is applied."
|
||||||
;; additional information relative to a footnote reference.
|
;; additional information relative to a footnote reference.
|
||||||
|
|
||||||
(defun org-export-collect-footnote-definitions (data info)
|
(defun org-export-collect-footnote-definitions (data info)
|
||||||
"Return an alist between footnote label and its definition.
|
"Return an alist between footnote numbers, labels and definitions.
|
||||||
|
|
||||||
DATA is the parse tree from which definitions are collected.
|
DATA is the parse tree from which definitions are collected.
|
||||||
INFO is the plist used as a communication channel.
|
INFO is the plist used as a communication channel.
|
||||||
|
|
||||||
As anonymous footnotes have no label, the key used is that case
|
|
||||||
is their beginning position.
|
|
||||||
|
|
||||||
Definitions are sorted by order of references. They either
|
Definitions are sorted by order of references. They either
|
||||||
appear as Org data \(transcoded with `org-export-data'\) or as
|
appear as Org data \(transcoded with `org-export-data'\) or as
|
||||||
a secondary string for inlined footnotes \(transcoded with
|
a secondary string for inlined footnotes \(transcoded with
|
||||||
|
@ -2126,19 +2123,10 @@ ignored."
|
||||||
(org-element-map
|
(org-element-map
|
||||||
data 'footnote-reference
|
data 'footnote-reference
|
||||||
(lambda (footnote local)
|
(lambda (footnote local)
|
||||||
(cond
|
(when (org-export-footnote-first-reference-p footnote local)
|
||||||
;; Definition already collected.
|
(list (org-export-get-footnote-number footnote local)
|
||||||
((not (org-export-footnote-first-reference-p footnote local)) nil)
|
(org-element-get-property :label footnote)
|
||||||
;; Reference has a label: Use it as a key, and get the
|
(org-export-get-footnote-definition footnote local))))
|
||||||
;; corresponding definition.
|
|
||||||
((org-element-get-property :label footnote)
|
|
||||||
(cons (org-element-get-property :label footnote)
|
|
||||||
(org-export-get-footnote-definition footnote local)))
|
|
||||||
;; No label: This is an anonymous footnote. Use beginning
|
|
||||||
;; position as the key and inline definition (a secondary
|
|
||||||
;; string) as its value.
|
|
||||||
(t (cons (org-element-get-property :begin footnote)
|
|
||||||
(org-element-get-property :inline-definition footnote)))))
|
|
||||||
info))
|
info))
|
||||||
|
|
||||||
(defun org-export-footnote-first-reference-p (footnote-reference info)
|
(defun org-export-footnote-first-reference-p (footnote-reference info)
|
||||||
|
|
Loading…
Reference in New Issue