* [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/)]
@ 2022-05-08 18:39 Moritz Schäfer
2022-10-18 7:47 ` Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Moritz Schäfer @ 2022-05-08 18:39 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]
Dear mailing list,
When exporting an org-file with org-id based links to odt, I get the
error error "FIXME: Unable to resolve <filename>", where <filename> is the
filename, the org-id-link was pointing to.
Org-id links (example below) are the default for org-roam (v2).
[[id:5222a0dd-5084-41bd-b61d-21dcb3290187][Note title]]
The issue lies within ox-odt.el in the org-odt-link function. There, '
destination' takes the value of the file name of the id-link target.
Therefore, (org-element-type destination) gets evaluated to 'plain-text,
which is not resolvable by 'org-odt-link--infer-description', thus it
raises the error.
I worked around this issue by adding a check for plain-text, but would like
to raise this issue here to find proper ideas on how to fix this.
(cond
;; workaround
((eq (org-element-type destination) 'plain-text)
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
destination
desc
))
;; workaround end
((not label-reference)
(org-odt-link--infer-description destination info))
Thank you,
Moritz
Emacs : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.16.0)
Package: Org mode version 9.5.2 (9.5.2-gfbff08 @
/home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)
[-- Attachment #2: Type: text/html, Size: 2015 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)]
2022-05-08 18:39 [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-18 7:47 ` Ihor Radchenko
2022-10-19 8:00 ` Moritz Schäfer
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-18 7:47 UTC (permalink / raw)
To: Moritz Schäfer; +Cc: emacs-orgmode
Moritz Schäfer <mail@moritzs.de> writes:
> When exporting an org-file with org-id based links to odt, I get the
> error error "FIXME: Unable to resolve <filename>", where <filename> is the
> filename, the org-id-link was pointing to.
>
> Org-id links (example below) are the default for org-roam (v2).
>
> [[id:5222a0dd-5084-41bd-b61d-21dcb3290187][Note title]]
>
> The issue lies within ox-odt.el in the org-odt-link function. There, '
> destination' takes the value of the file name of the id-link target.
> Therefore, (org-element-type destination) gets evaluated to 'plain-text,
> which is not resolvable by 'org-odt-link--infer-description', thus it
> raises the error.
>
> I worked around this issue by adding a check for plain-text, but would like
> to raise this issue here to find proper ideas on how to fix this.
Thanks for reporting, and sorry for the late reply.
Could you provide an example and steps demonstrating the problem?
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)]
2022-10-18 7:47 ` Ihor Radchenko
@ 2022-10-19 8:00 ` Moritz Schäfer
2022-10-19 10:36 ` Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Moritz Schäfer @ 2022-10-19 8:00 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Moritz Schäfer, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2862 bytes --]
Thanks for getting back to me on this.
Here is a minimal example. In org-roam (v2), when having a file/node:
*note_a.org <http://note_a.org>*:
*:PROPERTIES::ID: 3c885843-13ad-4dd8-a57f-de8271403b85:END:#+TITLE:
Note A*
and a second file *note_b.org <http://note_b.org>*:
*:PROPERTIES::ID: 715fdccf-0c40-4bbe-87b0-ae9787c46a1b:END:#+TITLE:
Note B[[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]*
and then run *(org-odt-export-to-odt)* (within the buffer *#note_b.org
<http://note_b.org>*), then I get the aforementioned error:
*OpenDocument export failed: FIXME: Unable to resolve "note_a.org
<http://note_a.org>"*
Hope this helps.
Best,
Moritz
On Tue, 18 Oct 2022 at 09:46, Ihor Radchenko <yantar92@posteo.net> wrote:
> Moritz Schäfer <mail@moritzs.de> writes:
>
> > When exporting an org-file with org-id based links to odt, I get the
> > error error "FIXME: Unable to resolve <filename>", where <filename> is
> the
> > filename, the org-id-link was pointing to.
> >
> > Org-id links (example below) are the default for org-roam (v2).
> >
> > [[id:5222a0dd-5084-41bd-b61d-21dcb3290187][Note title]]
> >
> > The issue lies within ox-odt.el in the org-odt-link function. There, '
> > destination' takes the value of the file name of the id-link target.
> > Therefore, (org-element-type destination) gets evaluated to 'plain-text,
> > which is not resolvable by 'org-odt-link--infer-description', thus it
> > raises the error.
> >
> > I worked around this issue by adding a check for plain-text, but would
> like
> > to raise this issue here to find proper ideas on how to fix this.
>
> Thanks for reporting, and sorry for the late reply.
> Could you provide an example and steps demonstrating the problem?
>
> --
> 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>
>
--
________________________________________
*Moritz Schäfer**, PhD*
Bioinformatician
Postdoctoral Fellow
Christoph Bock Group
________________________________________
*CeMM*
Research Center for Molecular Medicine
of the Austrian Academy of Sciences
Lazarettgasse 14, AKH BT 25.3
1090 Vienna, Austria
mschaefer@cemm.at
www.cemm.at
<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cemm.at%2F&data=04%7C01%7CMSchaefer%40cemm.oeaw.ac.at%7Cfe8b73cddbec4afadc7508d9d45f25d0%7Cca39edd17349449abbae314640be0def%7C0%7C0%7C637774327393913230%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=D7B51Q6CXLUjbo4ZsJreiJXhxs0%2FAnEM3qKZu5u%2BEfM%3D&reserved=0>
________________________________________
[-- Attachment #2: Type: text/html, Size: 8251 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)]
2022-10-19 8:00 ` Moritz Schäfer
@ 2022-10-19 10:36 ` Ihor Radchenko
2022-10-20 10:09 ` Max Nikulin
2022-10-21 12:02 ` [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
0 siblings, 2 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-19 10:36 UTC (permalink / raw)
To: Moritz Schäfer; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
Moritz Schäfer <mail@moritzs.de> writes:
> Thanks for getting back to me on this.
>
> Here is a minimal example. In org-roam (v2), when having a file/node:
Thanks! An example helps a lot.
Can you try the attached patch against the latest main branch?
[-- Attachment #2: 0001-ox-odt-Allow-id-links-to-files.patch --]
[-- Type: text/x-patch, Size: 1502 bytes --]
From 4e5c7373115cfeb88fb4392252d682fad8d178a8 Mon Sep 17 00:00:00 2001
Message-Id: <4e5c7373115cfeb88fb4392252d682fad8d178a8.1666175750.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 19 Oct 2022 18:33:44 +0800
Subject: [PATCH] ox-odt: Allow id: links to files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* lisp/ox-odt.el (org-odt-link): Transcode id: links to file property
drawers.
Reported-by: Moritz Schäfer <mail@moritzs.de>
Link: https://orgmode.org/list/CA+FVMQDBUwCQHFOWieELaB3=4MH2ybA66+NpCuQwvvv_1HVMzg@mail.gmail.com
---
lisp/ox-odt.el | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 208a39d9d..4ff667640 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2737,6 +2737,12 @@ (defun org-odt-link (link desc info)
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-get-reference destination info)
(or desc (org-export-get-ordinal destination info))))
+ ;; Link to a file, corresponding to string return value of
+ ;; `org-export-resolve-id-link'.
+ (plain-text
+ (format "<text:a xlink:type=\"simple\" xlink:href=\"%s\">%s</text:a>"
+ destination
+ (or desc (org-export-get-ordinal destination info))))
;; Fuzzy link points to some element (e.g., an inline image,
;; a math formula or a table).
(otherwise
--
2.35.1
[-- Attachment #3: Type: text/plain, Size: 225 bytes --]
--
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>
^ permalink raw reply related [flat|nested] 25+ messages in thread
* 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/)]
2022-10-19 10:36 ` Ihor Radchenko
@ 2022-10-20 10:09 ` Max Nikulin
2022-10-21 3:16 ` Ihor Radchenko
2022-10-21 12:02 ` [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
1 sibling, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-10-20 10:09 UTC (permalink / raw)
To: emacs-orgmode
On 19/10/2022 17:36, Ihor Radchenko wrote:
>
> --- a/lisp/ox-odt.el
> +++ b/lisp/ox-odt.el
> @@ -2737,6 +2737,12 @@ (defun org-odt-link (link desc info)
> (format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
> (org-export-get-reference destination info)
> (or desc (org-export-get-ordinal destination info))))
> + ;; Link to a file, corresponding to string return value of
> + ;; `org-export-resolve-id-link'.
> + (plain-text
> + (format "<text:a xlink:type=\"simple\" xlink:href=\"%s\">%s</text:a>"
> + destination
> + (or desc (org-export-get-ordinal destination info))))
I am apologizing if my comments make no sense. I remember a thread on
improper handling on id links in ox-html, so I am a bit surprised that a
link to the whole file (if I got the goal of the patch correctly, of
course) is the only problem with ODT.
- ox-html may transform file suffix from .org to .html. Have I missed
the same code for ox-odt?
- Doesn't destination should be passed through some quoting-escaping
function to avoid characters in file names that may make XML invalid?
(Perhaps id links between .org files will be broken earlier.)
Max Nikulin. Re: Internal link broken when publishing (was org-id with
ox-html) Tue, 14 Sep 2021 23:33:43 +0700.
https://list.orgmode.org/shqit9$8ds$1@ciao.gmane.io
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)]
2022-10-20 10:09 ` Max Nikulin
@ 2022-10-21 3:16 ` Ihor Radchenko
2022-10-21 14:46 ` Max Nikulin
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-21 3:16 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> I am apologizing if my comments make no sense. I remember a thread on
> improper handling on id links in ox-html, so I am a bit surprised that a
> link to the whole file (if I got the goal of the patch correctly, of
> course) is the only problem with ODT.
It is likely not the only problem. But this thread is about one
particular problem that should also be fixed regardless of others.
If you find other problems, please report them.
> - ox-html may transform file suffix from .org to .html. Have I missed
> the same code for ox-odt?
ox-html does it according to org-html-link-org-files-as-html. ox-odt
does not provide such feature. If people need it, it can be added.
Here, we at least fix the export error. So that people can at least get
some exported .odt file.
> - Doesn't destination should be passed through some quoting-escaping
> function to avoid characters in file names that may make XML invalid?
> (Perhaps id links between .org files will be broken earlier.)
>
> Max Nikulin. Re: Internal link broken when publishing (was org-id with
> ox-html) Tue, 14 Sep 2021 23:33:43 +0700.
> https://list.orgmode.org/shqit9$8ds$1@ciao.gmane.io
It should be. But, similar to ox-html, it is not escaped.
Patches welcome.
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)]
2022-10-21 3:16 ` Ihor Radchenko
@ 2022-10-21 14:46 ` Max Nikulin
2022-10-22 5:03 ` [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
0 siblings, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-10-21 14:46 UTC (permalink / raw)
To: emacs-orgmode
On 21/10/2022 10:16, Ihor Radchenko wrote:
> Max Nikulin writes:
>
>> I am apologizing if my comments make no sense. I remember a thread on
>> improper handling on id links in ox-html, so I am a bit surprised that a
>> link to the whole file (if I got the goal of the patch correctly, of
>> course) is the only problem with ODT.
>
> It is likely not the only problem. But this thread is about one
> particular problem that should also be fixed regardless of others.
> If you find other problems, please report them.
I am sorry. I confused this thread with some other bug report. I agree
that the original post describes namely file links. When Moritz provided
an example in response to your request for more details I decided that
more similar problems are coming. Perhaps particular use case does not
include links to specific headings in files and I was wrong. On the
other hand if ox-odt code works with id links better than ox-html then
the former may be a source of inspiration how to fix the latter.
> Here, we at least fix the export error. So that people can at least get
> some exported .odt file.
I have tried main HEAD (your fix should be applied) and I did not get an
error, but the result is quite strange. Consider a single file with an
internal link:
:PROPERTIES:
:ID: 3c885843-13ad-4dd8-a57f-de8271403b85
:END:
#+TITLE: Note A
* H 1
Some text
* H 2
[[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]
Link in the exported document:
<text:a xlink:type="simple" xlink:href="test-odt.org">Link to Note
A</text:a>
I would expect a target withing the same .odt file.
Properties as displayed in LibreOffice UI are even more peculiar:
Document path
file:///tmp/d/test-odt.odt/test-odt.org
Target in document is empty.
My expectation for path is file:///tmp/d/test-odt.odt or at least
file:///tmp/d/test-odt.org, but certainly not their combination. I am
unsure if you consider this observation as relevant to this thread.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [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/)])
2022-10-21 14:46 ` Max Nikulin
@ 2022-10-22 5:03 ` Ihor Radchenko
2022-10-22 8:04 ` Max Nikulin
2022-10-25 10:20 ` Max Nikulin
0 siblings, 2 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-22 5:03 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> I am sorry. I confused this thread with some other bug report. I agree
> that the original post describes namely file links. When Moritz provided
> an example in response to your request for more details I decided that
> more similar problems are coming. Perhaps particular use case does not
> include links to specific headings in files and I was wrong. On the
> other hand if ox-odt code works with id links better than ox-html then
> the former may be a source of inspiration how to fix the latter.
I am not sure which bug you are referring to.
>> Here, we at least fix the export error. So that people can at least get
>> some exported .odt file.
>
> I have tried main HEAD (your fix should be applied) and I did not get an
> error, but the result is quite strange. Consider a single file with an
> internal link:
>
> :PROPERTIES:
> :ID: 3c885843-13ad-4dd8-a57f-de8271403b85
> :END:
> #+TITLE: Note A
>
> * H 1
> Some text
>
> * H 2
> [[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]
>
> Link in the exported document:
>
> <text:a xlink:type="simple" xlink:href="test-odt.org">Link to Note
> A</text:a>
>
> I would expect a target withing the same .odt file.
>
> Properties as displayed in LibreOffice UI are even more peculiar:
> Document path
> file:///tmp/d/test-odt.odt/test-odt.org
> Target in document is empty.
>
> My expectation for path is file:///tmp/d/test-odt.odt or at least
> file:///tmp/d/test-odt.org, but certainly not their combination. I am
> unsure if you consider this observation as relevant to this thread.
I improved the code a bit, directly reusing file: link transcoder:
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=2f5e7103e59f06631e985d3dd39af21b5b7464ea
However, it does not change your observed behaviour.
I also tried the following Org file, and it looks like something is wrong
about file: link export in ox-odt. Even file: links have the erroneous
document path.
Probably, href=file.org is treated as a link to resource packed inside
.odt file.
I tried to look through
https://www.w3.org/TR/2001/REC-xlink-20010627/#link-locators, but I
cannot see any obvious correct way to link to external files from odt.
May someone more familiar with ODT schema take a look?
:PROPERTIES:
:ID: 3c885843-13ad-4dd8-a57f-de8271403b85
:END:
#+TITLE: Note A
* H 1
Some text
* H 2
[[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]
[[file:test.org]]
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-22 5:03 ` [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 8:04 ` Max Nikulin
2022-10-23 4:29 ` Ihor Radchenko
2022-10-25 10:20 ` Max Nikulin
1 sibling, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-10-22 8:04 UTC (permalink / raw)
To: emacs-orgmode
On 22/10/2022 12:03, Ihor Radchenko wrote:
>
> Probably, href=file.org is treated as a link to resource packed inside
> .odt file.
At least internal anchors should be "#...". I have not figure out how to
embed another document (attach a file) to see its link href.
> I tried to look through
> https://www.w3.org/TR/2001/REC-xlink-20010627/#link-locators, but I
> cannot see any obvious correct way to link to external files from odt.
> May someone more familiar with ODT schema take a look?
I tried to create a link to a file in the same directory in LibreOffice
Writer. To my surprise it contains "../"
<text:a xlink:type="simple" xlink:href="../verse.org"
text:style-name="Internet_20_link"
text:visited-style-name="Visited_20_Internet_20_Link">
<text:span text:style-name="T2">verse</text:span>
</text:a>
I have no idea why implicit xml:base in treated in such way. From my
point of view it is a bug in LibreOffice (6.4.7 in my case).
pandoc-2.5 generates a link that can not be opened by LibreOffice as
well (no leading ../).
echo '<a href="verse.org">A</a>' | pandoc -f html -t odt -o pandoc.odt
<text:a xlink:type="simple" xlink:href="verse.org"
office:name=""><text:span
text:style-name="Definition">A</text:span></text:a>
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-22 8:04 ` Max Nikulin
@ 2022-10-23 4:29 ` Ihor Radchenko
2022-10-24 11:40 ` Max Nikulin
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-23 4:29 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> pandoc-2.5 generates a link that can not be opened by LibreOffice as
> well (no leading ../).
>
> echo '<a href="verse.org">A</a>' | pandoc -f html -t odt -o pandoc.odt
>
> <text:a xlink:type="simple" xlink:href="verse.org"
> office:name=""><text:span
> text:style-name="Definition">A</text:span></text:a>
May you ask pandoc people about this?
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-23 4:29 ` Ihor Radchenko
@ 2022-10-24 11:40 ` Max Nikulin
0 siblings, 0 replies; 25+ messages in thread
From: Max Nikulin @ 2022-10-24 11:40 UTC (permalink / raw)
To: emacs-orgmode
On 23/10/2022 11:29, Ihor Radchenko wrote:
> Max Nikulin writes:
>
>> pandoc-2.5 generates a link that can not be opened by LibreOffice as
>> well (no leading ../).
>>
>> echo '<a href="verse.org">A</a>' | pandoc -f html -t odt -o pandoc.odt
>>
>> <text:a xlink:type="simple" xlink:href="verse.org"
>> office:name=""><text:span
>> text:style-name="Definition">A</text:span></text:a>
>
> May you ask pandoc people about this?
Pandoc, I have installed, is too old for a bug report, but such issue
was created several years ago:
https://github.com/jgm/pandoc/issues/3524
ODT: relative links #3524
Unfortunately attempts to find similar discussions related to office
applications give excessive noise related to UI recipes. I mostly avoid
office software, so I may miss something quite obvious for experienced
users.
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-22 5:03 ` [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 8:04 ` Max Nikulin
@ 2022-10-25 10:20 ` Max Nikulin
2022-10-31 6:13 ` Ihor Radchenko
1 sibling, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-10-25 10:20 UTC (permalink / raw)
To: emacs-orgmode
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 "../".
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part2-packages/OpenDocument-v1.3-os-part2-packages.html#__RefHeading__752821_826425813
3.7 Usage of IRIs Within Packages
in Open Document Format for Office Applications (OpenDocument) Version
1.3. Part 2: Packages
https://bz.apache.org/ooo/show_bug.cgi?id=98211
98211 – Hyperlink to local file in filesystem generate a wrong relative path
Thanks to https://github.com/jgm (pandoc developer)
It seems, EPUB explicitly disallows relative links to external
resources, however the discussion is long and I may the conclusion wrong.
https://github.com/w3c/epub-specs/issues/1888
What base URLs to use for URL parsing in EPUB?
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-25 10:20 ` Max Nikulin
@ 2022-10-31 6:13 ` Ihor Radchenko
2022-10-31 14:37 ` Max Nikulin
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-31 6:13 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-odt-link-Fix-relative-file-links.patch --]
[-- Type: text/x-patch, Size: 1570 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 225 bytes --]
--
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>
^ permalink raw reply related [flat|nested] 25+ messages in thread
* 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/)])
2022-10-31 6:13 ` Ihor Radchenko
@ 2022-10-31 14:37 ` Max Nikulin
2022-11-01 5:40 ` Ihor Radchenko
` (2 more replies)
0 siblings, 3 replies; 25+ messages in thread
From: Max Nikulin @ 2022-10-31 14:37 UTC (permalink / raw)
To: emacs-orgmode
On 31/10/2022 13:13, Ihor Radchenko wrote:
>
>> 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.
>
> - (org-export-file-uri raw-path))
> + (pcase (org-export-file-uri raw-path)
[[file:~/examples/org/odt-id/file-b.org]] link is exported as
./file:///home/user/examples/org/odt-id/file-b.org
> + (`(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))))
A couple of other notes.
In HTML <a href="#">top</a> or #top works as a link to the beginning of
the document. I am curious if ODF has a similar feature. I mean ID at
the top of the same file that generates file.org link instead of
internal one for both HTML and ODF formats.
It seems org-id.el should be extended to handle some features common to
all formats such as custom suffix instead of ".org"
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-31 14:37 ` Max Nikulin
@ 2022-11-01 5:40 ` Ihor Radchenko
2022-11-01 15:04 ` Max Nikulin
2022-11-01 5:47 ` org-export: How to handle links to the exported file? " Ihor Radchenko
2022-11-01 5:48 ` [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
2 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-11-01 5:40 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 214 bytes --]
Max Nikulin <manikulin@gmail.com> writes:
> [[file:~/examples/org/odt-id/file-b.org]] link is exported as
> ./file:///home/user/examples/org/odt-id/file-b.org
Thanks!
See the attached new version of the patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-org-odt-link-Fix-relative-file-links.patch --]
[-- Type: text/x-patch, Size: 1674 bytes --]
From 8ee8528366bbf31ed8510f005e032176711d15b9 Mon Sep 17 00:00:00 2001
Message-Id: <8ee8528366bbf31ed8510f005e032176711d15b9.1667280462.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 31 Oct 2022 14:11:19 +0800
Subject: [PATCH v2] 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 | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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)
+ (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)))
--
2.35.1
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
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>
^ permalink raw reply related [flat|nested] 25+ messages in thread
* 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/)])
2022-11-01 5:40 ` Ihor Radchenko
@ 2022-11-01 15:04 ` Max Nikulin
2022-11-02 5:04 ` Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-11-01 15:04 UTC (permalink / raw)
To: emacs-orgmode
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.
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-11-01 15:04 ` Max Nikulin
@ 2022-11-02 5:04 ` Ihor Radchenko
2022-11-02 15:39 ` Max Nikulin
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-11-02 5:04 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]
Max Nikulin <manikulin@gmail.com> writes:
>> - (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.
You are indeed right.
See the attached new version of the patch.
> 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.
I also noticed this, but I feel that it is reasonable. In odt,
"file-b.org" implies a resource inside the odt archive. "../file-b.org"
will highlight that it is an external file.
I'd prefer to leave the "../file" description for now and only do
something when/if we hear from the ox-odt users.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v3-0001-org-odt-link-Fix-relative-file-links.patch --]
[-- Type: text/x-patch, Size: 1620 bytes --]
From c72d90244eb1a0fafb42a8c7841be82ad882efc5 Mon Sep 17 00:00:00 2001
Message-Id: <c72d90244eb1a0fafb42a8c7841be82ad882efc5.1667364775.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 31 Oct 2022 14:11:19 +0800
Subject: [PATCH v3] 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..11b834d5d 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))
+ (let ((path-uri (org-export-file-uri raw-path)))
+ (if (string-prefix-p "file://" path-uri)
+ path
+ ;; Otherwise, it is a relative 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
[-- Attachment #3: Type: text/plain, Size: 225 bytes --]
--
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>
^ permalink raw reply related [flat|nested] 25+ messages in thread
* 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/)])
2022-11-02 5:04 ` Ihor Radchenko
@ 2022-11-02 15:39 ` Max Nikulin
2022-11-03 6:25 ` [DISCUSSION] Default description for relative file links in odt export (was: [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
0 siblings, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-11-02 15:39 UTC (permalink / raw)
To: emacs-orgmode
On 02/11/2022 12:04, Ihor Radchenko wrote:
> See the attached new version of the patch.
The patch looks reasonable. I have not tried it in action though.
> Max Nikulin <manikulin@gmail.com> writes:
>> [[file:file-b.org]]
>>
>> "../file-b.org" is appropriate default description. I do not expect
>> "../" here.
>
> I also noticed this, but I feel that it is reasonable. In odt,
> "file-b.org" implies a resource inside the odt archive. "../file-b.org"
> will highlight that it is an external file.
>
> I'd prefer to leave the "../file" description for now and only do
> something when/if we hear from the ox-odt users.
While e.g. EPUB may have multiple content files inside the container, I
am unaware of similar feature for ODF. E.g. master document is linked to
other "containers", not to files inside the same container. I consider
links to resources inside .zip as something really special. I am afraid
that "../" will cause user confusion like we had in the beginning.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [DISCUSSION] Default description for relative file links in odt export (was: [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/)]))
2022-11-02 15:39 ` Max Nikulin
@ 2022-11-03 6:25 ` Ihor Radchenko
0 siblings, 0 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-11-03 6:25 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
In ODT, the ./ is _inside_ the odt archive and the current
directory is "../". Then, the default description for file links is
"../file", which is somewhat confusing.
Should we change it and tweak the default description of relative file
links in odt? This will only matter during odt export of relative file
links without description.
Max Nikulin <manikulin@gmail.com> writes:
>> I also noticed this, but I feel that it is reasonable. In odt,
>> "file-b.org" implies a resource inside the odt archive. "../file-b.org"
>> will highlight that it is an external file.
>>
>> I'd prefer to leave the "../file" description for now and only do
>> something when/if we hear from the ox-odt users.
--------
> On 02/11/2022 12:04, Ihor Radchenko wrote:
>> See the attached new version of the patch.
>
> The patch looks reasonable. I have not tried it in action though.
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=210630e546bbd746a98ac252316763371b3ccaf1
Regardless of the default description issue, we want this fix.
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* org-export: How to handle links to the exported file? (was: [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/)]))
2022-10-31 14:37 ` Max Nikulin
2022-11-01 5:40 ` Ihor Radchenko
@ 2022-11-01 5:47 ` Ihor Radchenko
2022-11-01 15:18 ` org-export: How to handle links to the exported file? Max Nikulin
2022-11-01 5:48 ` [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
2 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-11-01 5:47 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
TLDR: If we have and Org file with a link point to the same Org file,
how should we export it?
Max Nikulin <manikulin@gmail.com> writes:
> A couple of other notes.
>
> In HTML <a href="#">top</a> or #top works as a link to the beginning of
> the document. I am curious if ODF has a similar feature. I mean ID at
> the top of the same file that generates file.org link instead of
> internal one for both HTML and ODF formats.
Currently, we have no convention.
In Org mode:
- [[file:/path/to/self]] links will do nothing, or follow org-file-apps.
- [[if:document-property-drawer-id]] links will move point to the top
What about export?
- Should we treat links as file links to the original Org file?
(One can argue that it is a good default is one wants to write
something like: "This document has been generated from
file:/link/to/source.org"
- Should we treat them as "jump to top", similar to our id: link
behaviour in Org?
I'd say that retaining the current behaviour will be the most reasonable.
I do not see much utility to linking to exported document itself, while
I do see a utility to link to the original file.
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: org-export: How to handle links to the exported file?
2022-11-01 5:47 ` org-export: How to handle links to the exported file? " Ihor Radchenko
@ 2022-11-01 15:18 ` Max Nikulin
0 siblings, 0 replies; 25+ messages in thread
From: Max Nikulin @ 2022-11-01 15:18 UTC (permalink / raw)
To: emacs-orgmode
On 01/11/2022 12:47, Ihor Radchenko wrote:
> Max Nikulin writes:
>>
>> In HTML <a href="#">top</a> or #top works as a link to the beginning of
>> the document. I am curious if ODF has a similar feature. I mean ID at
>> the top of the same file that generates file.org link instead of
>> internal one for both HTML and ODF formats.
>
> Currently, we have no convention.
>
> In Org mode:
> - [[file:/path/to/self]] links will do nothing, or follow org-file-apps.
> - [[if:document-property-drawer-id]] links will move point to the top
>
> What about export?
> - Should we treat links as file links to the original Org file?
> (One can argue that it is a good default is one wants to write
> something like: "This document has been generated from
> file:/link/to/source.org"
> - Should we treat them as "jump to top", similar to our id: link
> behaviour in Org?
>
> I'd say that retaining the current behaviour will be the most reasonable.
From my point of view "id:" link to the top of the same file should be
exported as a link to the beginning of the exported document.
- ox-odt creates a link to file.org
- ox-html to file.html#ID-...
I believe in both cases it should be just "#ID-..." or "#top" in the
case of HTML.
> I do not see much utility to linking to exported document itself, while
> I do see a utility to link to the original file.
I forgot about "link to source" use case. I have no idea how to
distinguish cases when a user links .org source files or exported files
(currently works for HTML only). It is applicable to both same and other
files. Ideally user should have choice for each link.
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)])
2022-10-31 14:37 ` Max Nikulin
2022-11-01 5:40 ` Ihor Radchenko
2022-11-01 5:47 ` org-export: How to handle links to the exported file? " Ihor Radchenko
@ 2022-11-01 5:48 ` Ihor Radchenko
2022-11-01 15:28 ` export and cross links between files Max Nikulin
2 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-11-01 5:48 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> It seems org-id.el should be extended to handle some features common to
> all formats such as custom suffix instead of ".org"
Could you please elaborate?
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* export and cross links between files
2022-11-01 5:48 ` [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-11-01 15:28 ` Max Nikulin
2022-11-02 6:38 ` [DISCUSSION] Unified handling of links between Org files on export (was: export and cross links between files) Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Max Nikulin @ 2022-11-01 15:28 UTC (permalink / raw)
To: emacs-orgmode
On 01/11/2022 12:48, Ihor Radchenko wrote:
> Max Nikulin writes:
>
>> It seems org-id.el should be extended to handle some features common to
>> all formats such as custom suffix instead of ".org"
>
> Could you please elaborate?
Currently ox-html has an option to replace links to .org files with
links to exported .html files. I suppose, this option should be
generalized to other export backends. It is up to user to set
appropriate target format to get cross links between exported files.
For ox-latex usually there is no point to link .tex files, target format
is almost certainly .pdf. However PDF files may be created from ODF or
HTML files, so a user should be able to specify arbitrary suffix, e.g.
".pdf", as a replacement of ".org" file links during export.
Besides "file:" links such feature should work at least for "id:" links.
There is another subthread to discuss link to .org source vs. link to
target format.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [DISCUSSION] Unified handling of links between Org files on export (was: export and cross links between files)
2022-11-01 15:28 ` export and cross links between files Max Nikulin
@ 2022-11-02 6:38 ` Ihor Radchenko
0 siblings, 0 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-11-02 6:38 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> On 01/11/2022 12:48, Ihor Radchenko wrote:
>> Max Nikulin writes:
>>
>>> It seems org-id.el should be extended to handle some features common to
>>> all formats such as custom suffix instead of ".org"
>>
>> Could you please elaborate?
>
> Currently ox-html has an option to replace links to .org files with
> links to exported .html files. I suppose, this option should be
> generalized to other export backends. It is up to user to set
> appropriate target format to get cross links between exported files.
Some export processors (like ox-texinfo) can export to multiple output
formats. A simple defcustom will not cut it because one may want
different link transformations depending on the issued export command.
I am not sure if there is a clean generalized way to implement link
transformations on ox.el level. Individual backends may support this
better.
I guess a possible somewhat generic solution could be adding a new key
to org-export-define-backend and org-export-define-derived-backend.
Specifically for transforming links to other org files.
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
* 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/)]
2022-10-19 10:36 ` Ihor Radchenko
2022-10-20 10:09 ` Max Nikulin
@ 2022-10-21 12:02 ` Ihor Radchenko
1 sibling, 0 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-10-21 12:02 UTC (permalink / raw)
To: Moritz Schäfer; +Cc: emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> Subject: [PATCH] ox-odt: Allow id: links to files
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * lisp/ox-odt.el (org-odt-link): Transcode id: links to file property
> drawers.
>
> Reported-by: Moritz Schäfer <mail@moritzs.de>
> Link: https://orgmode.org/list/CA+FVMQDBUwCQHFOWieELaB3=4MH2ybA66+NpCuQwvvv_1HVMzg@mail.gmail.com
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4e5c7373115cfeb88fb4392252d682fad8d178a8
We can further improve things, like with escaping the file name, but the
patch should at least fix the immediate export problem.
--
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>
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2022-11-03 6:26 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-08 18:39 [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-18 7:47 ` Ihor Radchenko
2022-10-19 8:00 ` Moritz Schäfer
2022-10-19 10:36 ` Ihor Radchenko
2022-10-20 10:09 ` Max Nikulin
2022-10-21 3:16 ` Ihor Radchenko
2022-10-21 14:46 ` Max Nikulin
2022-10-22 5:03 ` [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 8:04 ` Max Nikulin
2022-10-23 4:29 ` Ihor Radchenko
2022-10-24 11:40 ` Max Nikulin
2022-10-25 10:20 ` Max Nikulin
2022-10-31 6:13 ` Ihor Radchenko
2022-10-31 14:37 ` Max Nikulin
2022-11-01 5:40 ` Ihor Radchenko
2022-11-01 15:04 ` Max Nikulin
2022-11-02 5:04 ` Ihor Radchenko
2022-11-02 15:39 ` Max Nikulin
2022-11-03 6:25 ` [DISCUSSION] Default description for relative file links in odt export (was: [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-11-01 5:47 ` org-export: How to handle links to the exported file? " Ihor Radchenko
2022-11-01 15:18 ` org-export: How to handle links to the exported file? Max Nikulin
2022-11-01 5:48 ` [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-11-01 15:28 ` export and cross links between files Max Nikulin
2022-11-02 6:38 ` [DISCUSSION] Unified handling of links between Org files on export (was: export and cross links between files) Ihor Radchenko
2022-10-21 12:02 ` [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
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).