summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-07-16 14:11:52 (GMT)
committer Nicolas Goaziou <mail@nicolasgoaziou.fr>2014-07-16 14:11:52 (GMT)
commit8d0f7340ed0bb7d524029f651cd50311b1b2e8d4 (patch)
tree33dc79b40c1e9671326a06612e1f96a080ede3db
parent9cf3c4e9712aba63be36eac7193e4ac85f491f8b (diff)
downloadorg-mode-8d0f7340ed0bb7d524029f651cd50311b1b2e8d4.zip
org-mode-8d0f7340ed0bb7d524029f651cd50311b1b2e8d4.tar.gz
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
-rw-r--r--lisp/ox.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index 7fbbed1..db5a3c4 100644
--- a/lisp/ox.el
+++ b/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.