ox-html: Small refactoring

* lisp/ox-html.el (org-html-link): Small refactoring.
This commit is contained in:
Nicolas Goaziou 2013-06-29 14:20:19 +02:00
parent 6037c0da46
commit 29aec9448a

View file

@ -2702,8 +2702,6 @@ INFO is a plist holding contextual information. See
(or desc (or desc
(org-export-data (org-export-data
(org-element-property :raw-link link) info)))) (org-element-property :raw-link link) info))))
;; Fuzzy link points to an invisible target.
(keyword nil)
;; Link points to a headline. ;; Link points to a headline.
(headline (headline
(let ((href (let ((href
@ -2737,23 +2735,24 @@ INFO is a plist holding contextual information. See
:title destination) info))))) :title destination) info)))))
(format "<a href=\"#%s\"%s>%s</a>" (format "<a href=\"#%s\"%s>%s</a>"
(org-export-solidify-link-text href) attributes desc))) (org-export-solidify-link-text href) attributes desc)))
;; Fuzzy link points to a target. Do as above. ;; Fuzzy link points to a target or an element.
(t (t
(let ((path (org-export-solidify-link-text path)) number (let* ((path (org-export-solidify-link-text path)) number
(org-html-standalone-image-predicate 'org-html--has-caption-p)) (org-html-standalone-image-predicate 'org-html--has-caption-p)
(unless desc (number (cond
(setq number (cond (desc nil)
((org-html-standalone-image-p destination info) ((org-html-standalone-image-p destination info)
(org-export-get-ordinal (org-export-get-ordinal
(assoc 'link (org-element-contents destination)) (org-element-map destination 'link
'identity info t)
info 'link 'org-html-standalone-image-p)) info 'link 'org-html-standalone-image-p))
(t (org-export-get-ordinal (t (org-export-get-ordinal
destination info nil 'org-html--has-caption-p)))) destination info nil 'org-html--has-caption-p))))
(setq desc (when number (desc (cond (desc)
(if (atom number) (number-to-string number) ((not number) "No description for this link")
(mapconcat 'number-to-string number "."))))) ((numberp number) (number-to-string number))
(format "<a href=\"#%s\"%s>%s</a>" (t (mapconcat 'number-to-string number ".")))))
path attributes (or desc "No description for this link"))))))) (format "<a href=\"#%s\"%s>%s</a>" path attributes desc))))))
;; Coderef: replace link with the reference name or the ;; Coderef: replace link with the reference name or the
;; equivalent line number. ;; equivalent line number.
((string= type "coderef") ((string= type "coderef")