Function: org-texinfo--get-node
org-texinfo--get-node is a byte-compiled function defined in
ox-texinfo.el.gz.
Signature
(org-texinfo--get-node DATUM INFO)
Documentation
Return node or anchor associated to DATUM.
DATUM is a headline, a radio-target or a target. INFO is a plist used as a communication channel. The function guarantees the node or anchor name is unique.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-texinfo.el.gz
(defun org-texinfo--get-node (datum info)
"Return node or anchor associated to DATUM.
DATUM is a headline, a radio-target or a target. INFO is a plist
used as a communication channel. The function guarantees the
node or anchor name is unique."
(let ((cache (plist-get info :texinfo-node-cache)))
(or (cdr (assq datum cache))
(let* ((salt 0)
(basename
(org-texinfo--sanitize-node
(pcase (org-element-type datum)
(`headline
(org-texinfo--sanitize-title
(org-export-get-alt-title datum info) info))
(`radio-target
(org-export-data (org-element-contents datum) info))
(`target
(org-element-property :value datum))
(_
(or (org-element-property :name datum)
(org-export-get-reference datum info))))))
(name basename))
;; Org exports deeper elements before their parents. If two
;; node names collide -- e.g., they have the same title --
;; within the same hierarchy, the second one would get the
;; smaller node name. This is counter-intuitive.
;; Consequently, we ensure that every parent headline gets
;; its node beforehand. As a recursive operation, this
;; achieves the desired effect.
(let ((parent (org-element-lineage datum 'headline)))
(when (and parent (not (assq parent cache)))
(org-texinfo--get-node parent info)
(setq cache (plist-get info :texinfo-node-cache))))
;; Ensure NAME is unique and not reserved node name "Top",
;; no matter what case is used.
(while (or (string-equal "Top" (capitalize name))
(rassoc name cache))
(setq name (concat basename (format " (%d)" (cl-incf salt)))))
(plist-put info :texinfo-node-cache (cons (cons datum name) cache))
name))))