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'.
This commit is contained in:
Nicolas Goaziou 2021-10-09 23:01:35 +02:00
parent b71474ff7f
commit 8dfc056fcc
1 changed files with 18 additions and 13 deletions

View File

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