From e0567c9cacc3a13d21a24ba3058d653a335ae9cb Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 20 Apr 2015 12:37:13 +0200 Subject: [PATCH] Export back-ends: Use `org-export-file-uri' * contrib/lisp/ox-groff.el (org-groff-link): * lisp/ox-html.el (org-html-link): * lisp/ox-latex.el (org-latex-link): * lisp/ox-man.el (org-man-link): * lisp/ox-md.el (org-md-link): * lisp/ox-odt.el (org-odt-link): * lisp/ox-texinfo.el (org-texinfo-link): Use `org-export-file-uri'. --- contrib/lisp/ox-groff.el | 3 +-- lisp/ox-html.el | 4 ++-- lisp/ox-latex.el | 3 +-- lisp/ox-man.el | 3 +-- lisp/ox-md.el | 6 +----- lisp/ox-odt.el | 3 +-- lisp/ox-texinfo.el | 3 +-- 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el index 96ead878a..ade3478b9 100644 --- a/contrib/lisp/ox-groff.el +++ b/contrib/lisp/ox-groff.el @@ -1252,8 +1252,7 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((and (string= type "file") (file-name-absolute-p raw-path)) - (concat "file://" raw-path)) + ((string= type "file") (org-export-file-uri raw-path)) (t raw-path)))) (cond ((org-export-custom-protocol-maybe link desc 'groff)) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 76afcd611..52618c84f 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2839,10 +2839,10 @@ INFO is a plist holding contextual information. See (setq raw-path (funcall link-org-files-as-html-maybe raw-path info)) ;; If file path is absolute, prepend it with protocol - ;; component - "file:". + ;; component - "file://". (cond ((file-name-absolute-p raw-path) - (setq raw-path (concat "file:" raw-path))) + (setq raw-path (org-export-file-uri raw-path))) ((and home use-abs-url) (setq raw-path (concat (file-name-as-directory home) raw-path)))) ;; Add search option, if any. A search option can be diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index ace7745cd..2727f1cb5 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2079,8 +2079,7 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto" "doi")) (concat type ":" raw-path)) - ((and (string= type "file") (file-name-absolute-p raw-path)) - (concat "file:" raw-path)) + ((string= type "file") (org-export-file-uri raw-path)) (t raw-path)))) (cond ;; Link type is handled by a special function. diff --git a/lisp/ox-man.el b/lisp/ox-man.el index e95c8b551..6388a5530 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -651,8 +651,7 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((and (string= type "file") (file-name-absolute-p raw-path)) - (concat "file:" raw-path)) + ((string= type "file") (org-export-file-uri raw-path)) (t raw-path))) protocol) (cond diff --git a/lisp/ox-md.el b/lisp/ox-md.el index b3fb10f10..e4291e51a 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -362,11 +362,7 @@ a communication channel." ((member type '("http" "https" "ftp")) (concat type ":" raw-path)) ((string= type "file") - (let ((path (funcall link-org-files-as-md raw-path))) - (if (not (file-name-absolute-p path)) path - ;; If file path is absolute, prepend it - ;; with "file:" component. - (concat "file:" path)))) + (org-export-file-uri (funcall link-org-files-as-md raw-path))) (t raw-path)))) (if (not contents) (format "<%s>" path) (format "[%s](%s)" contents path))))))) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 9e31468b6..a8544a435 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2747,8 +2747,7 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((and (string= type "file") (file-name-absolute-p raw-path)) - (concat "file:" raw-path)) + ((string= type "file") (org-export-file-uri raw-path)) (t raw-path))) ;; Convert & to & for correct XML representation (path (replace-regexp-in-string "&" "&" path))) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index ac7cbe3fe..dd15ba04b 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -909,8 +909,7 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp")) (concat type ":" raw-path)) - ((and (string= type "file") (file-name-absolute-p raw-path)) - (concat "file:" raw-path)) + ((string= type "file") (org-export-file-uri raw-path)) (t raw-path)))) (cond ((org-export-custom-protocol-maybe link desc 'texinfo)) -- 2.11.4.GIT