Zimwiki writer: remove automatic colon prefix before internal images (#5183)

* FIX #5183 : zimwiki : remove automatic colon prefix before internal images

![](foo.png) should be converted to {{foo.png}} (relative path)
![](/foo.png] should be converted to {{/foo.png}} (absolute path)

Therefore the ':' prefix is useless and must be removed.

I never used the zimwiki, but i submitted the similar dokuwiki fix.

1. The zimwiki syntax is inspired by dokuwiki
2. The zimwiki documentation does not mention the colon character for images
3. The pandoc zimwiki writer seems to be a copy-paste for the dokuwiki writer

If the PR #5184 is applied, I think this one should be applied too.
This commit is contained in:
damien clochard 2019-01-01 23:08:38 +01:00 committed by John MacFarlane
parent 814e97df92
commit 4ab2a46bdc
2 changed files with 4 additions and 8 deletions

View file

@ -109,9 +109,7 @@ blockToZimWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
let opt = if null txt
then ""
else "|" ++ if null tit then capt else tit ++ capt
-- Relative links fail isURI and receive a colon
prefix = if isURI src then "" else ":"
return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
return $ "{{" ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
blockToZimWiki opts (Para inlines) = do
indent <- gets stIndent
@ -383,9 +381,7 @@ inlineToZimWiki opts (Image attr alt (source, tit)) = do
("", _, False ) -> "|" ++ alt'
(_ , _, False ) -> "|" ++ tit
(_ , _, True ) -> ""
-- Relative links fail isURI and receive a colon
prefix = if isURI source then "" else ":"
return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"
return $ "{{" ++ source ++ imageDims opts attr ++ txt ++ "}}"
inlineToZimWiki opts (Note contents) = do
-- no concept of notes in zim wiki, use a text block

View file

@ -593,9 +593,9 @@ or here: <http://example.com/>
From “Voyage dans la Lune” by Georges Melies (1902):
{{:lalune.jpg|Voyage dans la Lune lalune}}
{{lalune.jpg|Voyage dans la Lune lalune}}
Here is a movie {{:movie.jpg|movie}} icon.
Here is a movie {{movie.jpg|movie}} icon.
----