ox: Fix `org-export-with-footnotes' behaviour

* lisp/ox.el (org-export--skip-p, org-export--interpret-p): When
  `org-export-with-footnotes' is nil, ignore completely footnotes
  references and definitions instead of exporting them verbatim.
* testing/lisp/test-ox.el: Add tests.
This commit is contained in:
Nicolas Goaziou 2013-04-21 09:58:40 +02:00
parent 8a5ac12268
commit d408d721c3
2 changed files with 17 additions and 3 deletions

View File

@ -1994,6 +1994,8 @@ a tree with a select tag."
(if (eq (car with-drawers-p) 'not)
(member-ignore-case name (cdr with-drawers-p))
(not (member-ignore-case name with-drawers-p))))))))
((footnote-definition footnote-reference)
(not (plist-get options :with-footnotes)))
((headline inlinetask)
(let ((with-tasks (plist-get options :with-tasks))
(todo (org-element-property :todo-keyword blob))
@ -2230,9 +2232,6 @@ according to export options INFO, stored as a plist."
(plist-get info :with-emphasize))
;; ... fixed-width areas.
(fixed-width (plist-get info :with-fixed-width))
;; ... footnotes...
((footnote-definition footnote-reference)
(plist-get info :with-footnotes))
;; ... LaTeX environments and fragments...
((latex-environment latex-fragment)
(let ((with-latex-p (plist-get info :with-latex)))

View File

@ -361,6 +361,21 @@ Paragraph"
(should
(equal (org-export-as 'test nil nil nil '(:with-drawers (not "BAR")))
":FOO:\nkeep\n:END:\n")))))
;; Footnotes.
(should
(equal "Footnote?"
(let ((org-footnote-section nil))
(org-test-with-temp-text "Footnote?[fn:1]\n\n[fn:1] Def"
(org-test-with-backend test
(org-trim
(org-export-as 'test nil nil nil '(:with-footnotes nil))))))))
(should
(equal "Footnote?[fn:1]\n\n[fn:1] Def"
(let ((org-footnote-section nil))
(org-test-with-temp-text "Footnote?[fn:1]\n\n[fn:1] Def"
(org-test-with-backend test
(org-trim
(org-export-as 'test nil nil nil '(:with-footnotes t))))))))
;; Inlinetasks.
(when (featurep 'org-inlinetask)
(should