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>
This commit is contained in:
Nicolas Goaziou 2016-03-10 10:10:29 +01:00
parent cb5f323b0d
commit 5a735b0b80
2 changed files with 20 additions and 1 deletions

View File

@ -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))

View File

@ -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))))))