0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 20:37:51 +00:00

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.
This commit is contained in:
Gustav Wikström 2020-01-14 21:45:31 +01:00
parent d70db54dbc
commit 0ac6a9e1fc
3 changed files with 7 additions and 6 deletions

View file

@ -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.

View file

@ -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

View file

@ -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