[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] ox-odt file: links are not pointing to the real files (was: [B
From: |
Ihor Radchenko |
Subject: |
Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]) |
Date: |
Mon, 31 Oct 2022 06:13:48 +0000 |
Max Nikulin <manikulin@gmail.com> writes:
> On 22/10/2022 12:03, Ihor Radchenko wrote:
>>
>> Probably, href=file.org is treated as a link to resource packed inside
>> .odt file.
>
> You are right. file.odt is a virtual folder representing ZIP container,
> so relative links to external files should be prefixed with "../".
Thanks for checking!
See the attached tentative patch.
>From 17077b56b60a59b3b8c8d6a3634fe4ad532d114b Mon Sep 17 00:00:00 2001
Message-Id:
<17077b56b60a59b3b8c8d6a3634fe4ad532d114b.1667196812.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 31 Oct 2022 14:11:19 +0800
Subject: [PATCH] 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
---
lisp/ox-odt.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 15a9cf2de..eac9cf82b 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2688,7 +2688,14 @@ (defun org-odt-link (link desc info)
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
((string= type "file")
- (org-export-file-uri raw-path))
+ (pcase (org-export-file-uri raw-path)
+ (`(and (pred #'file-name-absolute-p) ,path)
+ path)
+ (path
+ ;; OpenOffice treats base directory inside the odt
+ ;; archive. The directory containing the odt file
+ ;; is "../".
+ (concat "../" path))))
(t raw-path)))
;; Convert & to & for correct XML representation
(path (replace-regexp-in-string "&" "&" path)))
--
2.35.1
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], (continued)
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], Moritz Schäfer, 2022/10/19
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], Ihor Radchenko, 2022/10/19
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], Max Nikulin, 2022/10/20
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], Ihor Radchenko, 2022/10/20
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], Max Nikulin, 2022/10/21
- [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]), Ihor Radchenko, 2022/10/22
- Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]), Max Nikulin, 2022/10/22
- Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]), Ihor Radchenko, 2022/10/23
- Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]), Max Nikulin, 2022/10/24
- Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]), Max Nikulin, 2022/10/25
- Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]),
Ihor Radchenko <=
- Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]), Max Nikulin, 2022/10/31
- Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)], Ihor Radchenko, 2022/10/21