Browse Source

ox: Fix inline footnote definitions

* lisp/ox.el (org-export-collect-tree-properties): Make sure changes
  to the parse tree propagate to the value of
  `org-export-get-footnote-definition'.

Thanks to Florian Beck for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88419
Nicolas Goaziou 10 years ago
parent
commit
8d0f7340ed
1 changed files with 13 additions and 9 deletions
  1. 13 9
      lisp/ox.el

+ 13 - 9
lisp/ox.el

@@ -1953,17 +1953,21 @@ Return updated plist."
 	(plist-put info
 		   :headline-offset
 		   (- 1 (org-export--get-min-level data info))))
-  ;; Update footnotes definitions list with definitions in parse tree.
-  ;; This is required since buffer expansion might have modified
-  ;; boundaries of footnote definitions contained in the parse tree.
-  ;; This way, definitions in `footnote-definition-alist' are bound to
-  ;; match those in the parse tree.
+  ;; Footnote definitions in parse tree override those stored in
+  ;; `:footnote-definition-alist'.  This way, any change to
+  ;; a definition in the parse tree (e.g., through a parse tree
+  ;; filter) propagates into the alist.
   (let ((defs (plist-get info :footnote-definition-alist)))
-    (org-element-map data 'footnote-definition
+    (org-element-map data '(footnote-definition footnote-reference)
       (lambda (fn)
-	(push (cons (org-element-property :label fn)
-		    `(org-data nil ,@(org-element-contents fn)))
-	      defs)))
+	(cond ((eq (org-element-type fn) 'footnote-definition)
+	       (push (cons (org-element-property :label fn)
+			   (append '(org-data nil) (org-element-contents fn)))
+		     defs))
+	      ((eq (org-element-property :type fn) 'inline)
+	       (push (cons (org-element-property :label fn)
+			   (org-element-contents fn))
+		     defs)))))
     (setq info (plist-put info :footnote-definition-alist defs)))
   ;; Properties order doesn't matter: get the rest of the tree
   ;; properties.