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:
parent
3b77bc7c66
commit
255c596f37
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue