summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-04-10 10:38:06 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-04-10 10:39:24 +0200
commit7b97b631ef980b9b63ebc3f3fb38295a90ade90d (patch)
tree9c85d89fe6e4a2912018afeebabd4fed1aadb87f
parent98fdb642fcfe349b963ebb79274e29deec283079 (diff)
downloadorg-mode-7b97b631ef980b9b63ebc3f3fb38295a90ade90d.tar.gz
org-info: Correctly export info links to HTML
* lisp/org-info.el (org-info-export): New function. Reported-by: Richard Y. Kim <emacs18@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/96779>
-rw-r--r--lisp/org-info.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/org-info.el b/lisp/org-info.el
index dd3a0d3..b7c9466 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -40,7 +40,7 @@
(defvar Info-current-node)
;; Install the link type
-(org-add-link-type "info" 'org-info-open)
+(org-add-link-type "info" 'org-info-open 'org-info-export)
(add-hook 'org-store-link-functions 'org-info-store-link)
;; Implementation
@@ -81,6 +81,19 @@
nodename-or-index)))))
(user-error "Could not open: %s" name)))
+(defun org-info-export (path desc format)
+ "Export an info link.
+See `org-add-link-type' for details about PATH, DESC and FORMAT."
+ (when (eq format 'html)
+ (or (string-match "\\(.*\\)[#:]:?\\(.*\\)" path)
+ (string-match "\\(.*\\)" path))
+ (let ((filename (match-string 1 path))
+ (node (or (match-string 2 path) "Top")))
+ (format "<a href=\"%s.html#%s\">%s</a>"
+ filename
+ (replace-regexp-in-string " " "-" node)
+ (or desc path)))))
+
(provide 'org-info)
;;; org-info.el ends here