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'.
This commit is contained in:
Nicolas Goaziou 2015-04-20 12:37:13 +02:00
parent f85a961c23
commit e0567c9cac
7 changed files with 8 additions and 17 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 &amp; for correct XML representation
(path (replace-regexp-in-string "&" "&amp;" path)))

View File

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