summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorДядов Васил Стоянов <vdyadov@elvees.com>2013-01-24 15:10:56 (GMT)
committer Bastien Guerry <bzg@altern.org>2013-01-24 15:10:56 (GMT)
commit6f3cb7a8b5cb66d2ffe07fdcfb59e8fd983539f9 (patch)
tree215f91cc847aad94a96b7c50806bc44bb57bcb1b
parent255c596f3768ac34e75f2507846578c5dc4cbe08 (diff)
downloadorg-mode-6f3cb7a8b5cb66d2ffe07fdcfb59e8fd983539f9.zip
org-mode-6f3cb7a8b5cb66d2ffe07fdcfb59e8fd983539f9.tar.gz
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.
-rw-r--r--lisp/org-docview.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/org-docview.el b/lisp/org-docview.el
index 64c215d..d920878 100644
--- a/lisp/org-docview.el
+++ b/lisp/org-docview.el
@@ -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))