Function: org-html--reference

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

Signature

(org-html--reference DATUM INFO &optional NAMED-ONLY)

Documentation

Return an appropriate reference for DATUM.

DATUM is an element or a target type object. INFO is the current export state, as a plist.

When NAMED-ONLY is non-nil and DATUM has no NAME keyword, return nil. This doesn't apply to headlines, inline tasks, radio targets and targets.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-html.el.gz
(defun org-html--reference (datum info &optional named-only)
  "Return an appropriate reference for DATUM.

DATUM is an element or a `target' type object.  INFO is the
current export state, as a plist.

When NAMED-ONLY is non-nil and DATUM has no NAME keyword, return
nil.  This doesn't apply to headlines, inline tasks, radio
targets and targets."
  (let* ((type (org-element-type datum))
	 (custom-id (and (memq type '(headline inlinetask))
			 (org-element-property :CUSTOM_ID datum)))
	 (user-label
	  (or
	   custom-id
	   (and (memq type '(radio-target target))
		(org-element-property :value datum))
	   (org-element-property :name datum)
	   (when-let ((id (org-element-property :ID datum)))
	     (concat org-html--id-attr-prefix id)))))

    (cond
     ((and user-label
	   (or (plist-get info :html-prefer-user-labels)
	       ;; Used CUSTOM_ID property unconditionally.
	       custom-id))
      user-label)
     ((and named-only
	   (not (memq type '(headline inlinetask radio-target target)))
	   (not user-label))
      nil)
     (t
      (org-export-get-reference datum info)))))