mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-21 06:55:35 +00:00
org-docview.el (org-docview-export): New function to export docview links
* org-docview.el (org-docview-export): New function to export docview links. TINYCHANGE Patch slightly modified by Bastien.
This commit is contained in:
parent
255c596f37
commit
6f3cb7a8b5
@ -51,9 +51,22 @@
|
||||
|
||||
(autoload 'doc-view-goto-page "doc-view")
|
||||
|
||||
(org-add-link-type "docview" 'org-docview-open)
|
||||
(org-add-link-type "docview" 'org-docview-open 'org-docview-export)
|
||||
(add-hook 'org-store-link-functions 'org-docview-store-link)
|
||||
|
||||
(defun org-docview-export (link description format)
|
||||
"Export a docview link from Org files."
|
||||
(let* ((path (when (string-match "\\(.+\\)::.+" link)
|
||||
(match-string 1 link)))
|
||||
(desc (or description link)))
|
||||
(when (stringp path)
|
||||
(setq path (org-link-escape (expand-file-name path)))
|
||||
(cond
|
||||
((eq format 'html) (format "<a 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)))))
|
||||
|
||||
(defun org-docview-open (link)
|
||||
(when (string-match "\\(.*\\)::\\([0-9]+\\)$" link)
|
||||
(let* ((path (match-string 1 link))
|
||||
|
Loading…
Reference in New Issue
Block a user