1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

ox-texinfo: Fix @ref without description

* lisp/ox-texinfo.el (org-texinfo--@ref): Prefer @ref{} with a single
  argument when no description is provided.
This commit is contained in:
Nicolas Goaziou 2017-11-04 21:48:09 +01:00
parent 08c9de2a74
commit db16370c0b

View File

@ -1035,15 +1035,17 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(defun org-texinfo--@ref (datum description info)
"Return @ref command for element or object DATUM.
DESCRIPTION is the name of the section to print, as a string."
DESCRIPTION is the printed name of the section, as a string, or
nil."
(let ((node-name (org-texinfo--get-node datum info))
;; Sanitize DESCRIPTION for cross-reference use. In
;; particular, remove colons as they seem to cause (even
;; within @asis{...} to the Texinfo reader.
(title (replace-regexp-in-string
"[ \t]*:+" ""
(replace-regexp-in-string "," "@comma{}" description))))
(if (equal title node-name)
;; particular, remove colons as they seem to cause pain (even
;; within @asis{...}) to the Texinfo reader.
(title (and description
(replace-regexp-in-string
"[ \t]*:+" ""
(replace-regexp-in-string "," "@comma{}" description)))))
(if (or (not title) (equal title node-name))
(format "@ref{%s}" node-name)
(format "@ref{%s, , %s}" node-name title))))
@ -1091,20 +1093,8 @@ INFO is a plist holding contextual information. See
(org-element-type
(org-element-property :parent destination))))))
(let ((headline (org-element-lineage destination '(headline) t)))
(org-texinfo--@ref
headline
(or desc (org-texinfo--sanitize-title
(org-element-property :title headline) info))
info)))
(_
(org-texinfo--@ref
destination
(or desc
(pcase (org-export-get-ordinal destination info)
((and (pred integerp) n) (number-to-string n))
((and (pred consp) n) (mapconcat #'number-to-string n "."))
(_ "???"))) ;cannot guess the description
info)))))
(org-texinfo--@ref headline desc info)))
(_ (org-texinfo--@ref destination desc info)))))
((string= type "mailto")
(format "@email{%s}"
(concat (org-texinfo--sanitize-content path)