ox: Fix bug when expanding include keywords

* lisp/ox.el (org-export--prepare-file-contents): Do not find
  footnotes in non-Org files.

Thanks to Kyle Meyer for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/85677
This commit is contained in:
Nicolas Goaziou 2014-04-30 09:31:18 +02:00
parent 51893a4e3d
commit 3034f2895a
1 changed files with 13 additions and 12 deletions

View File

@ -3443,18 +3443,19 @@ with footnotes is included in a document."
;; Append ID to all footnote references and definitions, so they
;; become file specific and cannot collide with footnotes in other
;; included files.
(goto-char (point-min))
(while (re-search-forward org-footnote-re nil t)
(let ((reference (org-element-context)))
(when (memq (org-element-type reference)
'(footnote-reference footnote-definition))
(goto-char (org-element-property :begin reference))
(forward-char)
(let ((label (org-element-property :label reference)))
(cond ((not label))
((org-string-match-p "\\`[0-9]+\\'" label)
(insert (format "fn:%d-" id)))
(t (forward-char 3) (insert (format "%d-" id))))))))
(when id
(goto-char (point-min))
(while (re-search-forward org-footnote-re nil t)
(let ((reference (org-element-context)))
(when (memq (org-element-type reference)
'(footnote-reference footnote-definition))
(goto-char (org-element-property :begin reference))
(forward-char)
(let ((label (org-element-property :label reference)))
(cond ((not label))
((org-string-match-p "\\`[0-9]+\\'" label)
(insert (format "fn:%d-" id)))
(t (forward-char 3) (insert (format "%d-" id)))))))))
(org-element-normalize-string (buffer-string))))
(defun org-export-execute-babel-code ()