0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-23 18:19:20 +00:00

org-odt-link: Fix relative file links

* lisp/ox-odt.el (org-odt-link): Append an extra "../" to relative
links.  This is needed to conform with OpenOffice convention to treat
base path inside the odt archive.  The path containing the odt file is
thus "../".

Reported-by: Ihor Radchenko <yantar92@posteo.net>
Link: https://orgmode.org/list/87ilkc30wd.fsf@localhost
This commit is contained in:
Ihor Radchenko 2022-10-31 14:11:19 +08:00
parent 5bc6741a5a
commit 210630e546
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -2688,7 +2688,14 @@ INFO is a plist holding contextual information. See
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
((string= type "file")
(org-export-file-uri raw-path))
(let ((path-uri (org-export-file-uri raw-path)))
(if (string-prefix-p "file://" path-uri)
path-uri
;; Otherwise, it is a relative path.
;; OpenOffice treats base directory inside the odt
;; archive. The directory containing the odt file
;; is "../".
(concat "../" path-uri))))
(t raw-path)))
;; Convert & to &amp; for correct XML representation
(path (replace-regexp-in-string "&" "&amp;" path)))