Jelajahi Sumber

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
Nicolas Goaziou 11 tahun lalu
induk
melakukan
3034f2895a
1 mengubah file dengan 13 tambahan dan 12 penghapusan
  1. 13 12
      lisp/ox.el

+ 13 - 12
lisp/ox.el

@@ -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 ()