summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2014-04-17 09:15:09 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2014-04-17 11:30:15 +0200
commit9dac00129d5ab939bc535e9dc42b8243f1fc710f (patch)
tree6289b23efb4d8afaeea0cdd5d15999b320744d8d
parentb49cbf13389cc64154023b91433d9c886a537160 (diff)
downloadorg-mode-9dac00129d5ab939bc535e9dc42b8243f1fc710f.tar.gz
Update export back-ends wrt "file" link changes
* lisp/ox-latex.el (org-latex-link): * lisp/ox-html.el (org-html-link): Do not expand absolute file names and do not try to fix hierarchy part, as it is already taken care of at the parser level. * lisp/ox-md.el (org-md-link): Ditto. Also fix absolute file names. * lisp/ox-odt.el (org-odt-link): * lisp/ox-man.el (org-man-link): * lisp/ox-texinfo.el (org-texinfo-link): * contrib/lisp/ox-groff.el (org-groff-link): Ditto. Do not prepend scheme part to relative file names either. * contrib/lisp/ox-deck.el (org-deck-link): Small refactoring.
-rw-r--r--contrib/lisp/ox-deck.el2
-rw-r--r--contrib/lisp/ox-groff.el8
-rw-r--r--lisp/ox-html.el13
-rw-r--r--lisp/ox-latex.el5
-rw-r--r--lisp/ox-man.el10
-rw-r--r--lisp/ox-md.el6
-rw-r--r--lisp/ox-odt.el6
-rw-r--r--lisp/ox-texinfo.el6
8 files changed, 20 insertions, 36 deletions
diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el
index 60a2cbe..9d84b03 100644
--- a/contrib/lisp/ox-deck.el
+++ b/contrib/lisp/ox-deck.el
@@ -378,7 +378,7 @@ the \"slide\" class will be added to the to the list element,
(defun org-deck-link (link desc info)
(replace-regexp-in-string "href=\"#" "href=\"#outline-container-"
- (org-html-link link desc info)))
+ (org-export-with-backend 'html link desc info)))
(defun org-deck-template (contents info)
"Return complete document string after HTML conversion.
diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el
index 1990f87..8484def 100644
--- a/contrib/lisp/ox-groff.el
+++ b/contrib/lisp/ox-groff.el
@@ -1253,12 +1253,8 @@ INFO is a plist holding contextual information. See
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (when (string-match "\\(.+\\)::.+" raw-path)
- (setq raw-path (match-string 1 raw-path)))
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file://" raw-path))
(t raw-path)))
protocol)
(cond
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index c590d86..c82c642 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2667,13 +2667,12 @@ 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://".
- (cond ((file-name-absolute-p raw-path)
- (setq raw-path
- (concat "file://" (expand-file-name
- raw-path))))
- ((and home use-abs-url)
- (setq raw-path (concat (file-name-as-directory home) raw-path))))
+ ;; component - "file:".
+ (cond
+ ((file-name-absolute-p raw-path)
+ (setq raw-path (concat "file:" 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
;; relative to a custom-id or a headline title. Any other
;; option is ignored.
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 6a2f69d..5b30246 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1799,9 +1799,8 @@ INFO is a plist holding contextual information. See
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (if (not (file-name-absolute-p raw-path)) raw-path
- (concat "file://" (expand-file-name raw-path))))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
protocol)
(cond
diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index f5653f1..d58c119 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -638,21 +638,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
DESC is the description part of the link, or the empty string.
INFO is a plist holding contextual information. See
`org-export-data'."
-
(let* ((type (org-element-property :type link))
(raw-path (org-element-property :path link))
;; Ensure DESC really exists, or set it to nil.
(desc (and (not (string= desc "")) desc))
-
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (when (string-match "\\(.+\\)::.+" raw-path)
- (setq raw-path (match-string 1 raw-path)))
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
protocol)
(cond
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 47994ac..1f841c8 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -321,12 +321,12 @@ a communication channel."
(cond
((member type '("http" "https" "ftp"))
(concat type ":" raw-path))
- ((equal type "file")
+ ((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://" (expand-file-name raw-path)))))
+ ;; with "file:" component.
+ (concat "file:" 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 0ddf2d5..772017c 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2713,10 +2713,8 @@ INFO is a plist holding contextual information. See
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
;; Convert & to &amp; for correct XML representation
(path (replace-regexp-in-string "&" "&amp;" path))
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index ef881af..a961d7a 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -1222,10 +1222,8 @@ INFO is a plist holding contextual information. See
(path (cond
((member type '("http" "https" "ftp"))
(concat type ":" raw-path))
- ((string= type "file")
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
(email (if (string= type "mailto")
(let ((text (replace-regexp-in-string