Function: org-odt-footnote-reference

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

Signature

(org-odt-footnote-reference FOOTNOTE-REFERENCE CONTENTS INFO)

Documentation

Transcode a FOOTNOTE-REFERENCE element from Org to ODT.

CONTENTS is nil. INFO is a plist holding contextual information.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
;;;; Footnote Definition

;; Footnote Definitions are ignored.


;;;; Footnote Reference

(defun org-odt-footnote-reference (footnote-reference _contents info)
  "Transcode a FOOTNOTE-REFERENCE element from Org to ODT.
CONTENTS is nil.  INFO is a plist holding contextual information."
  (let ((--format-footnote-definition
	 (lambda (n def)
	   (setq n (format "%d" n))
	   (let ((id (concat  "fn" n))
		 (note-class "footnote"))
	     (format
	      "<text:note text:id=\"%s\" text:note-class=\"%s\">%s</text:note>"
	      id note-class
	      (concat
	       (format "<text:note-citation>%s</text:note-citation>" n)
	       (format "<text:note-body>%s</text:note-body>" def))))))
	(--format-footnote-reference
	 (lambda (n)
	   (setq n (format "%d" n))
	   (let ((note-class "footnote")
		 (ref-format "text")
		 (ref-name (concat "fn" n)))
	     (format
	      "<text:span text:style-name=\"%s\">%s</text:span>"
	      "OrgSuperscript"
	      (format "<text:note-ref text:note-class=\"%s\" text:reference-format=\"%s\" text:ref-name=\"%s\">%s</text:note-ref>"
		      note-class ref-format ref-name n))))))
    (concat
     ;; Insert separator between two footnotes in a row.
     (let ((prev (org-export-get-previous-element footnote-reference info)))
       (and (org-element-type-p prev 'footnote-reference)
	    (format "<text:span text:style-name=\"%s\">%s</text:span>"
		    "OrgSuperscript" ",")))
     ;; Transcode footnote reference.
     (let ((n (org-export-get-footnote-number footnote-reference info nil t)))
       (cond
	((not
	  (org-export-footnote-first-reference-p footnote-reference info nil t))
	 (funcall --format-footnote-reference n))
	(t
	 (let* ((raw (org-export-get-footnote-definition
		      footnote-reference info))
		(def
		 (let ((def (org-trim
			     (org-export-data-with-backend
			      raw
			      (org-export-create-backend
			       :parent 'odt
			       :transcoders
			       '((paragraph . (lambda (p c i)
						(org-odt--format-paragraph
						 p c i
						 "Footnote"
						 "OrgFootnoteCenter"
						 "OrgFootnoteQuotations")))))
			      info))))
		   ;; Inline definitions are secondary strings.  We
		   ;; need to wrap them within a paragraph.
		   (if (eq (org-element-class (car (org-element-contents raw)))
			   'element)
		       def
		     (format
		      "\n<text:p text:style-name=\"Footnote\">%s</text:p>"
		      def)))))
	   (funcall --format-footnote-definition n def))))))))