emacs-orgmode
[Top][All Lists]
Advanced

[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: Max Nikulin
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: Tue, 1 Nov 2022 22:04:20 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

On 01/11/2022 12:40, Ihor Radchenko wrote:
See the attached new version of the patch.

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 15a9cf2de..e4fb7eb84 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2688,7 +2688,16 @@ (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)

I am in doubts if this branch may be executed at all. For absolute file names `org-export-file-uri' adds "file:" prefix so I expect that `file-name-absolute-p' is always false.

+                   (path
+                    (if (string-prefix-p "file://" 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)))

This time I am not lucky enough to accidentally face a case with invalid link URI. However I do not think that for the link

     [[file:file-b.org]]

"../file-b.org" is appropriate default description. I do not expect "../" here.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]