Browse Source

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'.
Nicolas Goaziou 10 years ago
parent
commit
e0567c9cac
7 changed files with 8 additions and 17 deletions
  1. 1 2
      contrib/lisp/ox-groff.el
  2. 2 2
      lisp/ox-html.el
  3. 1 2
      lisp/ox-latex.el
  4. 1 2
      lisp/ox-man.el
  5. 1 5
      lisp/ox-md.el
  6. 1 2
      lisp/ox-odt.el
  7. 1 2
      lisp/ox-texinfo.el

+ 1 - 2
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))

+ 2 - 2
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

+ 1 - 2
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.

+ 1 - 2
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

+ 1 - 5
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)))))))

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

+ 1 - 2
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))