0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 18:36:26 +00:00

texinfo: Consider any variation on "Top" a reserved node name

* lisp/ox-texinfo.el (org-texinfo--get-node): Change node name if it
conflicts with variations like "top", since they also appear to be
reserved by Texinfo.
This commit is contained in:
Nicolas Goaziou 2021-04-19 14:32:53 +02:00
parent f6eca6505d
commit a89d96e6a5

View file

@ -489,16 +489,18 @@ node or anchor name is unique."
;; Org exports deeper elements before their parents. If two ;; Org exports deeper elements before their parents. If two
;; node names collide -- e.g., they have the same title -- ;; node names collide -- e.g., they have the same title --
;; within the same hierarchy, the second one would get the ;; within the same hierarchy, the second one would get the
;; shorter node name. This is counter-intuitive. ;; smaller node name. This is counter-intuitive.
;; Consequently, we ensure that every parent headline get ;; Consequently, we ensure that every parent headline gets
;; its node beforehand. As a recursive operation, this ;; its node beforehand. As a recursive operation, this
;; achieves the desired effect. ;; achieves the desired effect.
(let ((parent (org-element-lineage datum '(headline)))) (let ((parent (org-element-lineage datum '(headline))))
(when (and parent (not (assq parent cache))) (when (and parent (not (assq parent cache)))
(org-texinfo--get-node parent info) (org-texinfo--get-node parent info)
(setq cache (plist-get info :texinfo-node-cache)))) (setq cache (plist-get info :texinfo-node-cache))))
;; 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)) ;; 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))))) (setq name (concat basename (format " (%d)" (cl-incf salt)))))
(plist-put info :texinfo-node-cache (cons (cons datum name) cache)) (plist-put info :texinfo-node-cache (cons (cons datum name) cache))
name)))) name))))