diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-01-30 14:17:30 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-01-30 14:22:35 +0100 |
commit | 423756dd1193035f21a00b7a153943f2b46d58de (patch) | |
tree | 9fdd279e68f42615a5d1de823d4c8e80ab97494b | |
parent | cef4e582c238a70a1fcb4827aacbd1925d1a14da (diff) | |
download | org-mode-423756dd1193035f21a00b7a153943f2b46d58de.tar.gz |
org-export: Generalize fallback footnote definition to all exporters
* contrib/lisp/org-export.el (org-export-get-footnote-definition):
Provide a fallback definition when none can be found.
* contrib/lisp/org-e-latex.el (org-e-latex-footnote-reference): Revert
change made in 30ef385ee03ea1f92e07f368413c065630bc01b8 since it is
now handled at the export framework level.
* testing/lisp/test-org-export.el: Add test.
-rw-r--r-- | contrib/lisp/org-e-latex.el | 8 | ||||
-rw-r--r-- | contrib/lisp/org-export.el | 7 | ||||
-rw-r--r-- | testing/lisp/test-org-export.el | 8 |
3 files changed, 14 insertions, 9 deletions
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 7697b16..14f21e2 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -1371,13 +1371,9 @@ CONTENTS is nil. INFO is a plist holding contextual information." thereis (memq (org-element-type parent) '(footnote-reference footnote-definition table-cell))) "\\footnotemark") - ;; Otherwise, define it with \footnote command. If no definition - ;; is available, notify it with an intrusive fallback one. + ;; Otherwise, define it with \footnote command. (t - (let ((def (or (org-export-get-footnote-definition footnote-reference info) - '("FOOTNOTE DEFINITION NOT FOUND.")))) - (unless (eq (org-element-type def) 'org-data) - (setq def (cons 'org-data (cons nil def)))) + (let ((def (org-export-get-footnote-definition footnote-reference info))) (concat (format "\\footnote{%s}" (org-trim (org-export-data def info))) ;; Retrieve all footnote references within the footnote and diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 35a1bd8..db78b90 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -3267,10 +3267,13 @@ INFO is the plist used as a communication channel." (defun org-export-get-footnote-definition (footnote-reference info) "Return definition of FOOTNOTE-REFERENCE as parsed data. -INFO is the plist used as a communication channel." +INFO is the plist used as a communication channel. If no such +definition can be found, return the \"DEFINITION NOT FOUND\" +string." (let ((label (org-element-property :label footnote-reference))) (or (org-element-property :inline-definition footnote-reference) - (cdr (assoc label (plist-get info :footnote-definition-alist)))))) + (cdr (assoc label (plist-get info :footnote-definition-alist))) + "DEFINITION NOT FOUND."))) (defun org-export-get-footnote-number (footnote info) "Return number associated to a footnote. diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-org-export.el index 858ccda..1a91a8c 100644 --- a/testing/lisp/test-org-export.el +++ b/testing/lisp/test-org-export.el @@ -850,7 +850,13 @@ Paragraph[fn:1]" (org-export-backend-translate-table 'test))) (forward-line) (should (equal "ParagraphOut of scope\n" - (org-export-as 'test 'subtree))))))) + (org-export-as 'test 'subtree))))) + ;; 6. Footnotes without a definition should be provided a fallback + ;; definition. + (should + (org-test-with-parsed-data "[fn:1]" + (org-export-get-footnote-definition + (org-element-map tree 'footnote-reference 'identity info t) info))))) |