From 5136d2ee416b98c571d90862af7011743fd85fa9 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 26 Dec 2011 09:57:09 +0100 Subject: [PATCH] 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. --- contrib/lisp/org-export.el | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 1efed213b..65f377618 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -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)