Browse Source

ox: Fix multiple deactivated subscripts export

* lisp/ox.el (org-export--remove-uninterpreted-data-1): Fix multiple
  deactivated subscripts export.

* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.

Thanks to Xavier Garrido for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84403
Nicolas Goaziou 11 years ago
parent
commit
a7e12d2af5
2 changed files with 13 additions and 3 deletions
  1. 2 2
      lisp/ox.el
  2. 11 1
      testing/lisp/test-ox.el

+ 2 - 2
lisp/ox.el

@@ -2379,8 +2379,8 @@ returned by the function."
 				       ?\s)))))))))))
 	  (when new
 	    ;; Splice NEW at BLOB location in parse tree.
-	    (dolist (e new) (org-element-insert-before e blob))
-	    (org-element-extract-element blob))))
+	    (dolist (e new (org-element-extract-element blob))
+	      (unless (string= e "") (org-element-insert-before e blob))))))
     info)
   ;; Return modified parse tree.
   data)

+ 11 - 1
testing/lisp/test-ox.el

@@ -690,7 +690,17 @@ Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
 		(template . (lambda (c i) (org-export-data
 				      (plist-get i :title) i)))
 		(section . (lambda (s c i) c))))
-	     nil nil nil '(:with-sub-superscript nil))))))
+	     nil nil nil '(:with-sub-superscript nil)))))
+  ;; Special case: multiples uninterpreted objects in a row.
+  (should
+   (equal "a_b_c_d\n"
+	  (org-test-with-temp-text "a_b_c_d"
+	    (org-export-as
+	     (org-export-create-backend
+	      :transcoders '((subscript . (lambda (s c i) "dummy"))
+			     (paragraph . (lambda (p c i) c))
+			     (section . (lambda (s c i) c))))
+	     nil nil nil '(:with-sub-superscript {}))))))
 
 (ert-deftest test-org-export/export-scope ()
   "Test all export scopes."