Function: org-export-get-footnote-definition
org-export-get-footnote-definition is a byte-compiled function defined
in ox.el.gz.
Signature
(org-export-get-footnote-definition FOOTNOTE-REFERENCE INFO)
Documentation
Return definition of FOOTNOTE-REFERENCE as parsed data.
INFO is the plist used as a communication channel. If no such definition can be found, raise an error.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
;;;; For Footnotes
;;
;; `org-export-collect-footnote-definitions' is a tool to list
;; actually used footnotes definitions in the whole parse tree, or in
;; a headline, in order to add footnote listings throughout the
;; transcoded data.
;;
;; `org-export-footnote-first-reference-p' is a predicate used by some
;; backends, when they need to attach the footnote definition only to
;; the first occurrence of the corresponding label.
;;
;; `org-export-get-footnote-definition' and
;; `org-export-get-footnote-number' provide easier access to
;; additional information relative to a footnote reference.
(defun org-export-get-footnote-definition (footnote-reference info)
"Return definition of FOOTNOTE-REFERENCE as parsed data.
INFO is the plist used as a communication channel. If no such
definition can be found, raise an error."
(let ((label (org-element-property :label footnote-reference)))
(if (not label) (org-element-contents footnote-reference)
(let ((cache (or (plist-get info :footnote-definition-cache)
(let ((hash (make-hash-table :test #'equal)))
;; Cache all the footnotes in document for
;; later search.
(org-element-map (plist-get info :parse-tree)
'(footnote-definition footnote-reference)
(lambda (f)
;; Skip any standard footnote reference
;; since those cannot contain a
;; definition.
(unless (eq (org-element-property :type f) 'standard)
(puthash
(cons :element (org-element-property :label f))
f
hash)))
info)
(plist-put info :footnote-definition-cache hash)
hash))))
(or
(gethash label cache)
(puthash label
(let ((hashed (gethash (cons :element label) cache)))
(when hashed
(or (org-element-contents hashed)
;; Even if the contents are empty, we can not
;; return nil since that would eventually raise
;; the error. Instead, return the equivalent
;; empty string.
"")))
cache)
(error "Definition not found for footnote %s" label))))))