Function: org-cite-list-citations

org-cite-list-citations is a byte-compiled function defined in oc.el.gz.

Signature

(org-cite-list-citations INFO)

Documentation

List citations in the exported document.

Citations are ordered by appearance in the document, when following footnotes. INFO is the export communication channel, as a property list.

Source Code

;; Defined in /usr/src/emacs/lisp/org/oc.el.gz
(defun org-cite-list-citations (info)
  "List citations in the exported document.
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))
               (definition-cache (make-hash-table :test #'equal))
               (definition-list nil)
               (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)
                  (or (gethash label definition-cache)
                      (org-element-map
                          (or definition-list
                              (setq definition-list
                                    (org-element-map
                                        tree
                                        'footnote-definition
                                      #'identity info)))
                          'footnote-definition
                        (lambda (d)
                          (and (equal label (org-element-property :label d))
                               (puthash label
                                        (or (org-element-contents d) "")
                                        definition-cache)))
                        info t))))
               (search-cites
                (lambda (data)
                  (org-element-map data '(citation footnote-reference)
                    (lambda (datum)
                      (pcase (org-element-type datum)
                        ('citation (push datum cites))
                        ;; Do not force entering inline definitions, since
                        ;; `org-element-map' is going to enter it anyway.
                        ((guard (eq 'inline (org-element-property :type datum))))
                        ;; Walk footnote definition.
                        (_
                         (let ((label (org-element-property :label datum)))
                           (funcall search-cites
                                    (funcall find-definition label)))))
                      nil)
                    info nil 'footnote-definition t))))
        (funcall search-cites tree)
        (let ((result (nreverse cites)))
          (plist-put info :citations result)
          result))))