ox-texinfo: Change output for links to targets with no description

* lisp/ox-texinfo.el (org-texinfo-link): Change output for links to
  targets with no description.

See <http://permalink.gmane.org/gmane.emacs.orgmode/98007>.
This commit is contained in:
Nicolas Goaziou 2015-05-30 13:52:26 +02:00
parent 82b4b8a98c
commit 5e63d35ace
1 changed files with 19 additions and 16 deletions

View File

@ -996,22 +996,25 @@ INFO is a plist holding contextual information. See
(t (org-export-data (t (org-export-data
(org-element-property :title destination) info))))) (org-element-property :title destination) info)))))
(otherwise (otherwise
(let ((topic (format "@ref{%s,,%s}"
(or desc (org-texinfo--get-node destination info)
(if (and (eq (org-element-type destination) 'headline) (cond
(not (org-export-numbered-headline-p (desc)
destination info))) ;; No description is provided: first try to
(org-export-data ;; associate destination to a number.
(org-element-property :title destination) info)) ((let ((n (org-export-get-ordinal destination info)))
(let ((n (org-export-get-ordinal destination info))) (cond ((not n) nil)
(cond ((integerp n) n)
((not n) nil) (t (mapconcat #'number-to-string n ".")))))
((integerp n) n) ;; Then grab title of headline containing
(t (mapconcat #'number-to-string n "."))))))) ;; DESTINATION.
(when topic ((let ((h (org-element-lineage destination '(headline) t)))
(format "@ref{%s,,%s}" (and h
(org-texinfo--get-node destination info) (org-export-data
topic))))))) (org-element-property :title destination) info))))
;; Eventually, just return "Top" to refer to the
;; beginning of the info file.
(t "Top")))))))
((equal type "info") ((equal type "info")
(let* ((info-path (split-string path "[:#]")) (let* ((info-path (split-string path "[:#]"))
(info-manual (car info-path)) (info-manual (car info-path))