diff options
author | Bastien Guerry <bzg@altern.org> | 2013-01-24 16:09:12 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-01-24 16:09:12 +0100 |
commit | 255c596f3768ac34e75f2507846578c5dc4cbe08 (patch) | |
tree | 807832600deac759139f8dd2832559a99fe1e7df | |
parent | 3b77bc7c66e2f1e58b1c66f0e602de4def8e1c75 (diff) | |
download | org-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.el | 12 |
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§ion=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 |