mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-18 18:51:52 +00:00
org-export-activate-smart-quotes: Fix edge case with multiple secondary strings
* lisp/ox.el (org-export--smart-quote-status): Do not hash quote status by parent syntax node - it will create clashes when parent has multiple secondary strings. Instead, hash by parent + secondary string property. * testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add new test case. Reported-by: William Denton <william@williamdenton.org> Link: https://orgmode.org/list/TarY7-tR4TEmIu8jawOtTyyi03K93WIg7DsS1eXNylelCy2Hv-6OFNKOMQMukf70Tzf3uO_2F1Qe7xwrzb43SpJc4jxJZLN3W0MioKYbgzI=@williamdenton.org
This commit is contained in:
parent
ac1c72376c
commit
83696bf21f
@ -5854,7 +5854,7 @@ INFO is the current export state, as a plist."
|
||||
(let ((table (make-hash-table :test #'eq)))
|
||||
(plist-put info :smart-quote-cache table)
|
||||
table)))
|
||||
(value (gethash parent cache 'missing-data)))
|
||||
(value (gethash (cons parent (org-element-secondary-p s)) cache 'missing-data)))
|
||||
(if (not (eq value 'missing-data)) (cdr (assq s value))
|
||||
(let (level1-open full-status)
|
||||
(org-element-map
|
||||
@ -5922,7 +5922,7 @@ INFO is the current export state, as a plist."
|
||||
(when current-status
|
||||
(push (cons text (nreverse current-status)) full-status))))
|
||||
info nil org-element-recursive-objects)
|
||||
(puthash parent full-status cache)
|
||||
(puthash (cons parent (org-element-secondary-p s)) full-status cache)
|
||||
(cdr (assq s full-status))))))
|
||||
|
||||
(defun org-export-activate-smart-quotes (s encoding info &optional original)
|
||||
|
@ -4229,6 +4229,14 @@ This test does not cover listings and custom environments."
|
||||
(org-element-map tree 'plain-text
|
||||
(lambda (s) (org-export-activate-smart-quotes s :html info))
|
||||
info)))))
|
||||
;; Smart quotes when object has multiple secondary strings.
|
||||
(should
|
||||
(equal '(" “prefix” " " “suffix”")
|
||||
(let ((org-export-default-language "en"))
|
||||
(org-test-with-parsed-data "[cite:; \"prefix\" @key \"suffix\";]"
|
||||
(org-element-map tree 'plain-text
|
||||
(lambda (s) (org-export-activate-smart-quotes s :html info))
|
||||
info)))))
|
||||
;; Smart quotes in document keywords.
|
||||
(should
|
||||
(equal '("“" "”")
|
||||
|
Loading…
Reference in New Issue
Block a user