diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-06-06 02:14:36 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-06-06 02:18:40 +0200 |
commit | 93bc1b7c7ed3a3d434dfcc40404d4356ab5f6da2 (patch) | |
tree | 0c36923a284b69f2af72e838bb7a6620bcb24f01 | |
parent | d44cadbe3eabfaeb52089fdd313e75e8926ff7d2 (diff) | |
download | org-mode-93bc1b7c7ed3a3d434dfcc40404d4356ab5f6da2.tar.gz |
ox-texinfo: Improve algorithm to make node names uniquerelease_9.0.8
* lisp/ox-texinfo.el (org-texinfo--get-node): Use numbers to
differentiate between common base node names instead of "x".
-rw-r--r-- | lisp/ox-texinfo.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 463fb30..d40ced7 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -455,14 +455,17 @@ 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 ((name - (org-texinfo--sanitize-node - (if (eq (org-element-type datum) 'headline) - (org-export-data (org-export-get-alt-title datum info) info) - (org-export-get-reference datum info))))) + (let* ((salt 0) + (basename + (org-texinfo--sanitize-node + (if (eq (org-element-type datum) 'headline) + (org-export-data (org-export-get-alt-title datum info) + info) + (org-export-get-reference datum info)))) + (name basename)) ;; Ensure NAME is unique and not reserved node name "Top". (while (or (equal name "Top") (rassoc name cache)) - (setq name (concat name "x"))) + (setq name (concat basename (number-to-string (cl-incf salt))))) (plist-put info :texinfo-node-cache (cons (cons datum name) cache)) name)))) |