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