From 5a735b0b8045966fab57f035a694a65209d3bd80 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 10 Mar 2016 10:10:29 +0100 Subject: [PATCH] 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 --- lisp/ox.el | 6 +++++- testing/lisp/test-ox.el | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lisp/ox.el b/lisp/ox.el index b9c99eb2d..6f5ebf474 100644 --- a/lisp/ox.el +++ b/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)) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 136fdfeff..1852da17b 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2998,6 +2998,21 @@ Another text. (ref:text) (equal '("“" "”" "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 '("“foo”") + (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 '("“foo”") + (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))))))