emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 210630e546: org-odt-link: Fix relative file links


From: ELPA Syncer
Subject: [elpa] externals/org 210630e546: org-odt-link: Fix relative file links
Date: Thu, 3 Nov 2022 02:58:03 -0400 (EDT)

branch: externals/org
commit 210630e546bbd746a98ac252316763371b3ccaf1
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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 15a9cf2dec..cfd0c110b5 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -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)))



reply via email to

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