Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-02-17 08:37:55 +01:00
commit 473ca5c86c
3 changed files with 8 additions and 6 deletions

View File

@ -3195,7 +3195,7 @@ 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 "\\`///*\\(.:\\)?/" "\\1/" 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))))

View File

@ -4390,11 +4390,13 @@ has type \"radio\"."
(defun org-export-file-uri (filename)
"Return file URI associated to FILENAME."
(cond ((string-match-p "\\`//" filename) (concat "file:" filename))
(cond ((string-prefix-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)))))
(t
(let ((fullname (expand-file-name filename)))
(concat (if (string-prefix-p "/" fullname) "file://" "file:///")
fullname)))))
;;;; For References
;;

View File

@ -3311,7 +3311,7 @@ Another text. (ref:text)
;; Preserve relative filenames.
(should (equal "relative.org" (org-export-file-uri "relative.org")))
;; Local files start with "file://"
(should (equal (concat "file://" (expand-file-name "/local.org"))
(should (equal (concat (if (memq system-type '(windows-nt cygwin)) "file:///" "file://") (expand-file-name "/local.org"))
(org-export-file-uri "/local.org")))
;; Remote files start with "file://"
(should (equal "file://myself@some.where:papers/last.pdf"
@ -3320,7 +3320,7 @@ Another text. (ref:text)
(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")))))
(concat (if (memq system-type '(windows-nt cygwin)) "file:///" "file://") (expand-file-name "~/file.org")))))
(ert-deftest test-org-export/get-reference ()
"Test `org-export-get-reference' specifications."