diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-11-05 10:32:13 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-11-05 10:32:13 +0100 |
commit | 04f35fc473a8bec330c8f8cafd98564783193d9a (patch) | |
tree | 42a1a27f5c4ecfb40d99a02f88bb69eabf89853b | |
parent | c04e357f3d5d93484277a7e439847b1233b872bd (diff) | |
download | org-mode-04f35fc473a8bec330c8f8cafd98564783193d9a.tar.gz |
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'.
-rw-r--r-- | lisp/ox-texinfo.el | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 2eb60e8..66d3fc9 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -466,18 +466,25 @@ INFO is a plist used as a communication channel. See (defun org-texinfo--get-node (datum info) "Return node or anchor associated to DATUM. -DATUM is an element or object. INFO is a plist used as -a communication channel. The function guarantees the node or -anchor name is unique." +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 - (if (eq (org-element-type datum) 'headline) - (org-texinfo--sanitize-title - (org-export-get-alt-title datum info) info) - (org-export-get-reference datum info)))) + (pcase (org-element-type datum) + (`headline + (org-texinfo--sanitize-title + (org-export-get-alt-title datum info) 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)) ;; Ensure NAME is unique and not reserved node name "Top". (while (or (equal name "Top") (rassoc name cache)) |