Browse Source

ox: Fix uninterpreted subscript

* lisp/ox.el (org-export--remove-uninterpreted-data-1): Fix
  un-interpreted subscript containing another object.

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

Reported-by: Yasushi SHOJI <yashi@atmark-techno.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103553>
Nicolas Goaziou 5 years ago
parent
commit
7d1a6777d0
2 changed files with 11 additions and 1 deletions
  1. 1 1
      lisp/ox.el
  2. 10 0
      testing/lisp/test-ox.el

+ 1 - 1
lisp/ox.el

@@ -2757,7 +2757,7 @@ returned by the function."
 	(when new
 	  ;; Splice NEW at BLOB location in parse tree.
 	  (dolist (e new (org-element-extract-element blob))
-	    (unless (string= e "") (org-element-insert-before e blob))))))
+	    (unless (equal e "") (org-element-insert-before e blob))))))
     info nil nil t)
   ;; Return modified parse tree.
   data)

+ 10 - 0
testing/lisp/test-ox.el

@@ -778,6 +778,16 @@ Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
 			     (paragraph . (lambda (p c i) c))
 			     (section . (lambda (s c i) c))))
 	     nil nil nil '(:with-sub-superscript {})))))
+  (should
+   (equal "a_entity\n"
+	  (org-test-with-temp-text "a_\\alpha"
+	    (org-export-as
+	     (org-export-create-backend
+	      :transcoders '((entity . (lambda (e c i) "entity"))
+			     (subscript . (lambda (s c i) "dummy"))
+			     (paragraph . (lambda (p c i) c))
+			     (section . (lambda (s c i) c))))
+	     nil nil nil '(:with-sub-superscript nil)))))
   ;; Also handle uninterpreted objects in title.
   (should
    (equal "a_b"