Jelajahi Sumber

ox: Fix smart quotes within tables

* lisp/ox.el (org-export--smart-quote-status): Handle smart quotes
  within objects.

* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add
  tests.

Reported-by: Philipp Middendorf <pmi@hacon.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/105586>
Nicolas Goaziou 9 tahun lalu
induk
melakukan
5a735b0b80
2 mengubah file dengan 20 tambahan dan 1 penghapusan
  1. 5 1
      lisp/ox.el
  2. 15 0
      testing/lisp/test-ox.el

+ 5 - 1
lisp/ox.el

@@ -5200,7 +5200,11 @@ INFO is the current export state, as a plist."
 	 (value (gethash parent cache 'missing-data)))
     (if (not (eq value 'missing-data)) (cdr (assq s value))
       (let (level1-open full-status)
-	(org-element-map parent 'plain-text
+	(org-element-map
+	    (let ((secondary (org-element-secondary-p s)))
+	      (if secondary (org-element-property secondary parent)
+		(org-element-contents parent)))
+	    'plain-text
 	  (lambda (text)
 	    (let ((start 0) current-status)
 	      (while (setq start (string-match "['\"]" text start))

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

@@ -2998,6 +2998,21 @@ Another text. (ref:text)
    (equal '("&ldquo;" "&rdquo;" "Paragraph")
 	  (let ((org-export-default-language "en"))
 	    (org-test-with-parsed-data "#+CAPTION: \"$x$\"\nParagraph"
+	      (org-element-map tree 'plain-text
+		(lambda (s) (org-export-activate-smart-quotes s :html info))
+		info nil nil t)))))
+  ;; Smart quotes within objects.
+  (should
+   (equal '("&ldquo;foo&rdquo;")
+	  (let ((org-export-default-language "en"))
+	    (org-test-with-parsed-data "*\"foo\"*"
+	      (org-element-map tree 'plain-text
+		(lambda (s) (org-export-activate-smart-quotes s :html info))
+		info nil nil t)))))
+  (should
+   (equal '("&ldquo;foo&rdquo;")
+	  (let ((org-export-default-language "en"))
+	    (org-test-with-parsed-data "| \"foo\" |"
 	      (org-element-map tree 'plain-text
 		(lambda (s) (org-export-activate-smart-quotes s :html info))
 		info nil nil t))))))