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:
Nicolas Goaziou 2011-12-26 09:57:09 +01:00
parent a7afc47572
commit 5136d2ee41
1 changed files with 5 additions and 17 deletions

View File

@ -2110,14 +2110,11 @@ Point is at buffer's beginning when BODY is applied."
;; additional information relative to a footnote reference.
(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.
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
appear as Org data \(transcoded with `org-export-data'\) or as
a secondary string for inlined footnotes \(transcoded with
@ -2126,19 +2123,10 @@ ignored."
(org-element-map
data 'footnote-reference
(lambda (footnote local)
(cond
;; Definition already collected.
((not (org-export-footnote-first-reference-p footnote local)) nil)
;; Reference has a label: Use it as a key, and get the
;; 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)))))
(when (org-export-footnote-first-reference-p footnote local)
(list (org-export-get-footnote-number footnote local)
(org-element-get-property :label footnote)
(org-export-get-footnote-definition footnote local))))
info))
(defun org-export-footnote-first-reference-p (footnote-reference info)