0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 22:07:49 +00:00

ox-texinfo: Preserve target name as node.

* lisp/ox-texinfo.el (org-texinfo--get-node): Use target's value as
  base for the node name, instead of using `org-export-get-reference'.
This commit is contained in:
Nicolas Goaziou 2017-11-05 10:32:13 +01:00
parent c04e357f3d
commit 04f35fc473

View file

@ -466,18 +466,25 @@ INFO is a plist used as a communication channel. See
(defun org-texinfo--get-node (datum info) (defun org-texinfo--get-node (datum info)
"Return node or anchor associated to DATUM. "Return node or anchor associated to DATUM.
DATUM is an element or object. INFO is a plist used as DATUM is a headline, a radio-target or a target. INFO is a plist
a communication channel. The function guarantees the node or used as a communication channel. The function guarantees the
anchor name is unique." node or anchor name is unique."
(let ((cache (plist-get info :texinfo-node-cache))) (let ((cache (plist-get info :texinfo-node-cache)))
(or (cdr (assq datum cache)) (or (cdr (assq datum cache))
(let* ((salt 0) (let* ((salt 0)
(basename (basename
(org-texinfo--sanitize-node (org-texinfo--sanitize-node
(if (eq (org-element-type datum) 'headline) (pcase (org-element-type datum)
(`headline
(org-texinfo--sanitize-title (org-texinfo--sanitize-title
(org-export-get-alt-title datum info) info) (org-export-get-alt-title datum info) info))
(org-export-get-reference datum info)))) (`radio-target
(org-texinfo--sanitize-title
(org-element-contents datum) info))
(`target
(org-export-data (org-element-property :value datum) info))
(type
(error "Cannot generate node name for type: %S" type)))))
(name basename)) (name basename))
;; Ensure NAME is unique and not reserved node name "Top". ;; Ensure NAME is unique and not reserved node name "Top".
(while (or (equal name "Top") (rassoc name cache)) (while (or (equal name "Top") (rassoc name cache))