Bladeren bron

oc: Fix failing test about `org-cite-list-citations'

* lisp/oc.el (org-cite-list-citations): Properly implement
a simplified version of `org-export-get-footnote-definition'.
Nicolas Goaziou 4 jaren geleden
bovenliggende
commit
8dfc056fcc
1 gewijzigde bestanden met toevoegingen van 18 en 13 verwijderingen
  1. 18 13
      lisp/oc.el

+ 18 - 13
lisp/oc.el

@@ -789,6 +789,20 @@ Citations are ordered by appearance in the document, when following footnotes.
 INFO is the export communication channel, as a property list."
   (or (plist-get info :citations)
       (letrec ((cites nil)
+               (tree (plist-get info :parse-tree))
+               (find-definition
+                ;; Find definition for standard reference LABEL.  At
+                ;; this point, it is impossible to rely on
+                ;; `org-export-get-footnote-definition' because the
+                ;; function caches results that could contain
+                ;; un-processed citation objects.  So we use
+                ;; a simplified version of the function above.
+                (lambda (label)
+                  (org-element-map tree 'footnote-definition
+                    (lambda (d)
+                      (and (equal label (org-element-property :label d))
+                           (or (org-element-contents d) "")))
+                    info t)))
                (search-cites
                 (lambda (data)
                   (org-element-map data '(citation footnote-reference)
@@ -798,22 +812,13 @@ INFO is the export communication channel, as a property list."
 		        ;; Do not force entering inline definitions, since
 		        ;; `org-element-map' is going to enter it anyway.
                         ((guard (eq 'inline (org-element-property :type datum))))
-                        ;; Find definition for current standard
-                        ;; footnote reference.  Unlike to
-                        ;; `org-export-get-footnote-definition', do
-                        ;; not cache results as they would contain
-                        ;; un-processed citation objects.
+                        ;; Walk footnote definition.
                         (_
                          (let ((label (org-element-property :label datum)))
-                           (funcall
-                            search-cites
-                            (org-element-map data 'footnote-definition
-                              (lambda (d)
-                                (and
-                                 (equal label (org-element-property :label d))
-                                 (or (org-element-contents d) "")))))))))
+                           (funcall search-cites
+                                    (funcall find-definition label))))))
                     info nil 'footnote-definition t))))
-        (funcall search-cites (plist-get info :parse-tree))
+        (funcall search-cites tree)
         (let ((result (nreverse cites)))
           (plist-put info :citations result)
           result))))