-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix conformance to Zim (and enable Insert Audio button): wrong attachment directories, linked file not found, missing image link's tags, minsdk 16-18 #2147
Conversation
Hello @mehw the CI shows some build errors with these PR changes. Can you please check/fix that? |
@gsantner I'm on it. |
@gsantner I changed a test to reflect a new behavior, this fixes the CI: assume the current directory as top link if root cannot be determined. I thought this as a fallback, but also if the user wants to organize a notebook as a relative structure, without a specific root directory. When markor/app/src/main/java/net/gsantner/markor/format/wikitext/WikitextLinkResolver.java Lines 94 to 95 in 856175f
|
Due other PR's edited the same files/things, there are merge conflicts now. Can you please fix it? |
@gsantner I will look into it in these days. Forgive me for leaving you hanging. |
no problem |
The format {{}} is for images, other types should use [[]] instead. References: - https://github.com/zim-desktop-wiki/zim-desktop-wiki/blob/c88cf3cb53896bf272e87704826b77e82eddb3ef/data/manual/Help/Wiki_Syntax.txt Zim: Fix link/attachment path of file selection While editing a wiki file, Zim adds links to a target residing inside the Notebook (where notebook.zim file is found) resolving the path as relative to the wiki file's attachment directory (same parent/name of the wiki file, but without the extension). If a link's target is not a child of the Notebook, Zim adds the link as an absolute path. Zim always prefixes relative paths, adding './' if a link's target is a child of a wiki file's attachment directory. /home/user/Notebook # Notebook directory | | | `- notebook.zim # marks the root of the Notebook | | | `- wiki-example # wiki file's attachment directory | | | | | `- video.mkv # wiki-example.txt file attachment | | | `- wiki-example.txt # wiki file written in wiki markup | `- README # file outside the Notebook's root In wiki-example.txt, [[./video.mkv]] would be a link to an attachment residing in the 'wiki-example' directory. Linking notebook.zim would add [[../notebook.zim]], and [[/home/user/README]] would be a link to a file outside the Notebook. Zim: Fix attachment path of imported image Zim uses the path of the .txt wiki file for attachments, but without the extension, i.e. wiki-text.txt would be connected to wiki-text as attachment directory. Zim: Fix attachment path of edit image Zim local paths are relative to the current wiki file's attachment directory. Properly resolve an attachment path to edit the image. Zim: Fix file link conversion to markdown Zim inserts file links relative to a wiki page's attachment directory, if the target is a child of the Notebook. Adapt the conversion of Zim wiki pages to markdown, translating Zim file links accordingly. Zim: Fallback to the current directory as root Assume the current directory as top link if root cannot be determined. Zim: Interpret image link attributes Zim may insert attributes, as html tags, in an image link: id, width, height, type, href. {{./image.png?href=.%2Fvideo.mkv&id=anchor-name&width=50}} In markdown [![name](image)](link) is close to the above, but without the possibility to insert extra tags. Zim: Enable audio recording/link button Add logic to insert an audio recording/link. Zim: Contribution for link/attachment fixes Adding myself to CONTRIBUTORS.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I rebased your changes on my own upon master...hope I did it all right and your intended changes still work.
I could at least press the >attach image< button, the text was inserted and a picture displayed in view mode. So should be OK I guess.
Thanks
Thank you very much for all your hard work. Your consideration and merging my PR sure boost my mood ;) Please, forgive my hiatus. The last time I posted, I thought that I was ready to resume programming at full power but I had to accept to go easy limiting to what requires less brain effort. I truly regret not being able to keep my promises. On the bright side, I really enjoy programming and there are lots of things accumulated in my TODO list that keep me moving forward. I treasure people, that is my strength, and my interest in debugging is an integral part of me. I can't wait to be in tip-top shape for exploring the code. |
Thanks @mehw , feel welcome any time you want to join coding again. Would you mind to install the latest v2.12.5 update and check if I did alright with the merge conflict? (So your initial change now works as you wanted it to) |
Hello,
This series of patches is to conform the wikitext format to Zim:
{{}}
is for images, other types should use[[]]
.id
,width
,height
,href
; images can link other files.As an extra, the Insert Audio button is enabled.
More descriptions about Zim conformance are in the commits and in the code as comments.
Zim attachment directories
In
wiki-example.txt
,[[./video.mkv]]
would be a link to a file residing in thewiki-example
directory (relative path). Linkingnotebook.zim
would add[[../notebook.zim]]
, and[[/home/user/README]]
would be a link to a file outside the Notebook's root (absolute path).Zim image link's tags
If
{{./image.png?href=.%2Fvideo.mkv&id=anchor-name&width=50}}
is inwiki-example.txt
,./
is resolved to the wiki page's attachment directorywiki-example
, and in Markor you would have something like:<a href="/home/user/Notebook/wiki-example/video.mkv"><img src="wiki-example/image.png" alt="wiki-example.txt" id="anchor-name" width="50" /></a>