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
This commit is contained in:
Nicolas Goaziou 2014-07-16 16:11:52 +02:00
parent 9cf3c4e971
commit 8d0f7340ed
1 changed files with 13 additions and 9 deletions

View File

@ -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.