summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-01-24 16:09:12 +0100
committerBastien Guerry <bzg@altern.org>2013-01-24 16:09:12 +0100
commit255c596f3768ac34e75f2507846578c5dc4cbe08 (patch)
tree807832600deac759139f8dd2832559a99fe1e7df
parent3b77bc7c66e2f1e58b1c66f0e602de4def8e1c75 (diff)
downloadorg-mode-255c596f3768ac34e75f2507846578c5dc4cbe08.tar.gz
org-man.el (org-man-export): New function to export links of type "man"
* org-man.el (org-man-export): New function to export links of type "man".
-rw-r--r--contrib/lisp/org-man.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/lisp/org-man.el b/contrib/lisp/org-man.el
index 27e8cca..484f255 100644
--- a/contrib/lisp/org-man.el
+++ b/contrib/lisp/org-man.el
@@ -27,7 +27,7 @@
(require 'org)
-(org-add-link-type "man" 'org-man-open)
+(org-add-link-type "man" 'org-man-open 'org-man-export)
(add-hook 'org-store-link-functions 'org-man-store-link)
(defcustom org-man-command 'man
@@ -59,6 +59,16 @@ PATH should be a topic that can be thrown at the man command."
(match-string 1 (buffer-name))
(error "Cannot create link to this man page")))
+(defun org-man-export (link description format)
+ "Export a man page link from Org files."
+ (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
+ (desc (or description link)))
+ (cond
+ ((eq format 'html) (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
+ ((eq format 'latex) (format "\href{%s}{%s}" path desc))
+ ((eq format 'ascii) (format "%s (%s)" desc path))
+ (t path))))
+
(provide 'org-man)
;;; org-man.el ends here