summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-06 02:14:36 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-06 02:18:40 +0200
commit93bc1b7c7ed3a3d434dfcc40404d4356ab5f6da2 (patch)
tree0c36923a284b69f2af72e838bb7a6620bcb24f01
parentd44cadbe3eabfaeb52089fdd313e75e8926ff7d2 (diff)
downloadorg-mode-b6e440a8235006b274cbcd66d3a086133bf36448.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.el15
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))))