emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 83696bf21f 2/2: org-export-activate-smart-quotes: F


From: ELPA Syncer
Subject: [elpa] externals/org 83696bf21f 2/2: org-export-activate-smart-quotes: Fix edge case with multiple secondary strings
Date: Sun, 21 Jan 2024 09:58:29 -0500 (EST)

branch: externals/org
commit 83696bf21fe48ff3b698d20872aee6c46f5d2566
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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
---
 lisp/ox.el              | 4 ++--
 testing/lisp/test-ox.el | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 34ea32b3bb..32ca2ff102 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -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)
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index e59c20caef..63babe8cdf 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -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 '(" &ldquo;prefix&rdquo; " " &ldquo;suffix&rdquo;")
+         (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 '("&ldquo;" "&rdquo;")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]