summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustav Wikström <gustav@whil.se>2020-01-14 21:45:31 +0100
committerGustav Wikström <gustav@whil.se>2020-01-14 21:45:31 +0100
commit0ac6a9e1fcb71415df5ce287d4658f6a601b3df3 (patch)
tree748b1ecdf4767b49c3843958d68671f5340850b6
parentd70db54dbc32feb2034f5a07a346fb8bb75160d1 (diff)
downloadorg-mode-0ac6a9e1fcb71415df5ce287d4658f6a601b3df3.tar.gz
Further fix of exporting attachment links in export backends
* lisp/ox-html.el (org-html-link, org-html-inline-image-rules) * lisp/ox-odt.el (org-odt-inline-image-rules) * lisp/ox-texinfo.el (org-texinfo-link) (org-texinfo-inline-image-rules): Make attachment links consistently expand as relative to file and add attachment link type to image rules for consistency among export backends.
-rw-r--r--lisp/ox-html.el6
-rw-r--r--lisp/ox-odt.el3
-rw-r--r--lisp/ox-texinfo.el4
3 files changed, 7 insertions, 6 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 6fc4c60..aafeb69 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -886,6 +886,7 @@ link to the image."
(defcustom org-html-inline-image-rules
`(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))
+ ("attachment" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))
("http" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))
("https" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg"))))
"Rules characterizing image files that can be inlined into HTML.
@@ -3079,11 +3080,8 @@ INFO is a plist holding contextual information. See
((member type '("http" "https" "ftp" "mailto" "news"))
(url-encode-url (concat type ":" raw-path)))
((string= type "file")
- ;; Pre-parse the path from attachment-format to
- ;; file-format to make attachment links use all export
- ;; functionality from file links with correct pathing.
(when (string= raw-type "attachment")
- (setq raw-path (org-attach-expand raw-path)))
+ (setq raw-path (file-relative-name (org-attach-expand raw-path))))
;; During publishing, turn absolute file names belonging
;; to base directory into relative file names. Otherwise,
;; append "file" protocol to absolute file name.
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index dd881b9..e0def39 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -745,7 +745,8 @@ link's path."
:value-type (regexp :tag "Path")))
(defcustom org-odt-inline-image-rules
- '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
+ '(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))
+ ("attachment" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg"))))
"Rules characterizing image files that can be inlined into ODT.
A rule consists in an association whose key is the type of link
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 5416c8e..177007b 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -407,6 +407,8 @@ If two strings share the same prefix (e.g. \"ISO-8859-1\" and
(defconst org-texinfo-inline-image-rules
(list (cons "file"
+ (regexp-opt '("eps" "pdf" "png" "jpg" "jpeg" "gif" "svg")))
+ (cons "attachment"
(regexp-opt '("eps" "pdf" "png" "jpg" "jpeg" "gif" "svg"))))
"Rules characterizing image files that can be inlined.")
@@ -1064,7 +1066,7 @@ INFO is a plist holding contextual information. See
(concat type ":" raw-path))
((string= type "file")
(when (string= raw-type "attachment")
- (setq raw-path (org-attach-expand raw-path)))
+ (setq raw-path (file-relative-name (org-attach-expand raw-path))))
(org-export-file-uri raw-path))
(t raw-path))))
(cond