From 06a4c2c8d0737fd4a2b405dec435648b19b4578a Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 26 Jun 2011 18:44:27 +0200 Subject: [PATCH] org-footnote: better normalization during export * lisp/org-footnote.el (org-footnote-normalize): remember footnotes seen so far by the exporter when choosing the new marker. --- lisp/org-footnote.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index f12d018c7..052a55e5c 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -508,10 +508,11 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': (outline-regexp (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))) ;; Determine the highest marker used so far. - (count (if (and pre-process-p org-export-footnotes-markers) - (apply 'max (mapcar 'car org-export-footnotes-markers)) + (ref-table (when pre-process-p org-export-footnotes-markers)) + (count (if (and pre-process-p ref-table) + (apply 'max (mapcar (lambda (e) (nth 1 e)) ref-table)) 0)) - ref-table ins-point ref) + ins-point ref) (save-excursion ;; 1. Find every footnote reference, extract the definition, and ;; collect that data in REF-TABLE. If SORT-ONLY is nil, also @@ -629,10 +630,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': ;; When exporting, add newly insert markers along with their ;; associated definition to `org-export-footnotes-markers'. (when pre-process-p - (setq org-export-footnotes-markers - (append (mapcar (lambda (ref) (cons (nth 1 ref) (nth 2 ref))) - ref-table) - org-export-footnotes-markers)))) + (setq org-export-footnotes-markers ref-table))) ;; Else, insert each definition at the end of the section ;; containing their first reference. Happens only in Org ;; files with no special footnote section, and only when