summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-09-26 00:14:36 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-09-26 00:14:36 +0200
commit6f2579b4fca54f0225edc9a5c4a7282d25bf1bb4 (patch)
tree721d9112c1de6795a586daa859cc467ee3e9681a
parentfe182cf0d74ba6920a6265f11531c69c827c245e (diff)
parentfd8a18151a7a64ded36c169f03c76bf96733bfd9 (diff)
downloadorg-mode-6f2579b4fca54f0225edc9a5c4a7282d25bf1bb4.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-element.el4
-rw-r--r--lisp/ox.el10
-rw-r--r--testing/lisp/test-ox.el2
3 files changed, 8 insertions, 8 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 329a439..d37bf6f 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3099,13 +3099,13 @@ Assume point is at the beginning of the link."
(when (string-match "::\\(.*\\)\\'" path)
(setq search-option (match-string 1 path))
(setq path (replace-match "" nil nil path)))
- (setq path (replace-regexp-in-string "\\`/+" "/" path)))
+ (setq path (replace-regexp-in-string "\\`///+" "/" path)))
;; Translate link, if `org-link-translation-function' is set.
(let ((trans (and (functionp org-link-translation-function)
(funcall org-link-translation-function type path))))
(when trans
(setq type (car trans))
- (setq path (cdr trans))))
+ (setq path (cdr trans))))
(list 'link
(list :type type
:path path
diff --git a/lisp/ox.el b/lisp/ox.el
index aa422b0..0d6711c 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4195,12 +4195,10 @@ has type \"radio\"."
(defun org-export-file-uri (filename)
"Return file URI associated to FILENAME."
- (if (not (file-name-absolute-p filename)) filename
- (concat "file:/"
- (and (not (org-file-remote-p filename)) "/")
- (if (org-string-match-p "\\`~" filename)
- (expand-file-name filename)
- filename))))
+ (cond ((org-string-match-p "\\`//" filename) (concat "file:" filename))
+ ((not (file-name-absolute-p filename)) filename)
+ ((org-file-remote-p filename) (concat "file:/" filename))
+ (t (concat "file://" (expand-file-name filename)))))
;;;; For References
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 96cc5d4..c5e2218 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -2726,6 +2726,8 @@ Another text. (ref:text)
;; Remote files start with "file://"
(should (equal "file://myself@some.where:papers/last.pdf"
(org-export-file-uri "/myself@some.where:papers/last.pdf")))
+ (should (equal "file://localhost/etc/fstab"
+ (org-export-file-uri "//localhost/etc/fstab")))
;; Expand filename starting with "~".
(should (equal (org-export-file-uri "~/file.org")
(concat "file://" (expand-file-name "~/file.org")))))