summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-03-21 20:08:24 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-03-25 20:29:31 +0100
commita6d9fd82ea849e17afdecb22e1f5d00e9e8e579a (patch)
tree14903b73bbb701a87c8671984f5f4bc61ecd08df
parenta3e8a1d6048f36057a38fe31c34d5fae98b684bb (diff)
downloadorg-mode-a6d9fd82ea849e17afdecb22e1f5d00e9e8e579a.tar.gz
ox: White spaces after export snippets are never ignored
* lisp/ox.el (org-export-data): White spaces after export snippets are never ignored. * testing/lisp/test-ox.el: Add test. Back-end developers should pay attention to the fact that white spaces before and after an ignored export snippet now are accumulated in the output.
-rw-r--r--lisp/ox.el8
-rw-r--r--testing/lisp/test-ox.el11
2 files changed, 16 insertions, 3 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index a3694b6..1aa5f1e 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -2062,8 +2062,12 @@ Return transcoded string."
(eq (plist-get info :with-archived-trees) 'headline)
(org-element-property :archivedp data)))
(let ((transcoder (org-export-transcoder data info)))
- (and (functionp transcoder)
- (funcall transcoder data nil info))))
+ (or (and (functionp transcoder)
+ (funcall transcoder data nil info))
+ ;; Export snippets never return a nil value so
+ ;; that white spaces following them are never
+ ;; ignored.
+ (and (eq type 'export-snippet) ""))))
;; Element/Object with contents.
(t
(let ((transcoder (org-export-transcoder data info)))
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 766a771..8832bcd 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -871,7 +871,16 @@ body\n")))
(let ((org-export-snippet-translation-alist nil))
(should (equal (org-export-as 'test) "A\n")))
(let ((org-export-snippet-translation-alist '(("t" . "test"))))
- (should (equal (org-export-as 'test) "AB\n"))))))
+ (should (equal (org-export-as 'test) "AB\n")))))
+ ;; Ignored export snippets do not remove any blank.
+ (should
+ (equal "begin end\n"
+ (org-test-with-parsed-data "begin @@test:A@@ end"
+ (org-export-data-with-translations
+ tree
+ '((paragraph . (lambda (paragraph contents info) contents))
+ (section . (lambda (section contents info) contents)))
+ info)))))