diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-05-30 13:52:26 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-05-30 13:52:26 +0200 |
commit | 5e63d35acecb1fd85da84447c670fc2f29bc55c3 (patch) | |
tree | 7881d80b0fa815fd102a3ec6b97b5110ac965bba | |
parent | 82b4b8a98cda22ec657d1fce5bd2f9d294c64e35 (diff) | |
download | org-mode-5e63d35acecb1fd85da84447c670fc2f29bc55c3.tar.gz |
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>.
-rw-r--r-- | lisp/ox-texinfo.el | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 259cc61..d7a48b7 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -996,22 +996,25 @@ INFO is a plist holding contextual information. See (t (org-export-data (org-element-property :title destination) info))))) (otherwise - (let ((topic - (or desc - (if (and (eq (org-element-type destination) 'headline) - (not (org-export-numbered-headline-p - destination info))) - (org-export-data - (org-element-property :title destination) info)) - (let ((n (org-export-get-ordinal destination info))) - (cond - ((not n) nil) - ((integerp n) n) - (t (mapconcat #'number-to-string n "."))))))) - (when topic - (format "@ref{%s,,%s}" - (org-texinfo--get-node destination info) - topic))))))) + (format "@ref{%s,,%s}" + (org-texinfo--get-node destination info) + (cond + (desc) + ;; No description is provided: first try to + ;; associate destination to a number. + ((let ((n (org-export-get-ordinal destination info))) + (cond ((not n) nil) + ((integerp n) n) + (t (mapconcat #'number-to-string n "."))))) + ;; Then grab title of headline containing + ;; DESTINATION. + ((let ((h (org-element-lineage destination '(headline) t))) + (and h + (org-export-data + (org-element-property :title destination) info)))) + ;; Eventually, just return "Top" to refer to the + ;; beginning of the info file. + (t "Top"))))))) ((equal type "info") (let* ((info-path (split-string path "[:#]")) (info-manual (car info-path)) |