Function: org-export--footnote-reference-map

org-export--footnote-reference-map is a byte-compiled function defined in ox.el.gz.

Signature

(org-export--footnote-reference-map FUNCTION DATA INFO &optional BODY-FIRST)

Documentation

Apply FUNCTION on every footnote reference in DATA.

INFO is a plist containing export state. By default, as soon as a new footnote reference is encountered, FUNCTION is called onto its definition. However, if BODY-FIRST is non-nil, this step is delayed until the end of the process.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export--footnote-reference-map
    (function data info &optional body-first)
  "Apply FUNCTION on every footnote reference in DATA.
INFO is a plist containing export state.  By default, as soon as
a new footnote reference is encountered, FUNCTION is called onto
its definition.  However, if BODY-FIRST is non-nil, this step is
delayed until the end of the process."
  (letrec ((definitions nil)
	   (seen-refs nil)
	   (search-ref
	    (lambda (data delayp)
	      ;; Search footnote references through DATA, filling
	      ;; SEEN-REFS along the way.  When DELAYP is non-nil,
	      ;; store footnote definitions so they can be entered
	      ;; later.
	      (org-element-map data 'footnote-reference
		(lambda (f)
		  (funcall function f)
		  (let ((--label (org-element-property :label f)))
		    (unless (and --label (member --label seen-refs))
		      (when --label (push --label seen-refs))
		      ;; Search for subsequent references in footnote
		      ;; definition so numbering follows reading
		      ;; logic, unless DELAYP in non-nil.
		      (cond
		       (delayp
			(push (org-export-get-footnote-definition f info)
			      definitions))
		       ;; Do not force entering inline definitions,
		       ;; since `org-element-map' already traverses
		       ;; them at the right time.
		       ((eq (org-element-property :type f) 'inline))
		       (t (funcall search-ref
				   (org-export-get-footnote-definition f info)
				   nil))))))
		info nil
		;; Don't enter footnote definitions since it will
		;; happen when their first reference is found.
		;; Moreover, if DELAYP is non-nil, make sure we
		;; postpone entering definitions of inline references.
		(if delayp '(footnote-definition footnote-reference)
		  'footnote-definition)))))
    (funcall search-ref data body-first)
    (funcall search-ref (nreverse definitions) nil)))