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".
This commit is contained in:
Bastien Guerry 2013-01-24 16:09:12 +01:00
parent 3b77bc7c66
commit 255c596f37
1 changed files with 11 additions and 1 deletions

View File

@ -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