Zim

using relative path, once more

Asked by Zoltán Vörös

I know that this question has been raised in https://lists.launchpad.net/zim-wiki/msg00877.html , and there a solution was suggested, but that did not quite answer the original question: is there a deep reason as to why zim cannot handle relative paths, if they are not in the notes root? This would definitely make notes portable between computers. I have large data folders that I want to link to, but I do not want to place all those data folders into the notes root.
If it is doable with some tweaking of the source code, I can look into that.
Thanks,
Zoltán

Question information

Language:
English Edit question
Status:
Solved
For:
Zim Edit question
Assignee:
No assignee Edit question
Solved by:
Zoltán Vörös
Solved:
Last query:
Last reply:
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) said :
#1

I'm sorry, but I do not understand the issue. You can put in paths relative
to the file or relative to the "document root". I don't think there is a
limitation on linking relative outside of the notebook folder.

-- Jaap

Revision history for this message
Zoltán Vörös (zvoros) said :
#2

The problem is this:
If I add a link to Notes/test.dat located in /home/v923z/Notes/, then in the source I get the following

[[../test.dat]]

i.e., the path is relative to the page. However, if I add a link to th file /home/v923z/test.dat, then the corresponding link is

 [[~/brightness.py]]

which is absolute. (The tilde will be expanded, anyway.) What I want is that even in the second case, the link be

[[../../test.dat]]

which would be relative to the page, but would not be in Notes/. It seems to me that zim cannot expand the relative path, if it leads out of the root of the notes.
Zoltán

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) said :
#3

Please note that the "~" substitution is done by the dialog. Maybe the
algorithm there should be refined. However this does not mean you can not
have the "../../" link. E.g. just type in "[[../../test.dat]] in the page
and reload it.

The alternative is to assign a "document root". Assuming that you have a
certain folder structure that is portable, just set the "document root" to
point to the top of that structure (see File -> Properties). Now you can
link relative to that root using "/test.dat". Afterward you only need to
change this property and all links will follow.

I even think the document root property can be relative to the notebook
folder, but need to check to be sure.

-- Jaap

Revision history for this message
Zoltán Vörös (zvoros) said :
#4

Greetings Jaap,

Your first method did not work for me: the link was still expanded in the source as ~/test.dat. However, setting the document root has solved the problem. Thanks,
Zoltán