git.iko.soy/typeable/pandoc
on master help sign in
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.

commit4ab2a46bdcb7337ca6e23037e53b1dc88b2d2240 authordamien clochard <damien@dalibo.info> dateTue 1 Jan 2019, 23:08 (8 years ago) parent814e97d
2 files changed+4−8
src/Text/Pandoc/Writers/ZimWiki.hs+2−6 test/writer.zimwiki+2−2
src/Text/Pandoc/Writers/ZimWiki.hs+2−6
@@ -109,9 +109,7 @@ blockToZimWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
109109 let opt = if null txt
110110 then ""
111111 else "|" ++ if null tit then capt else tit ++ capt
112− -- Relative links fail isURI and receive a colon
113− prefix = if isURI src then "" else ":"
114− return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
112+ return $ "{{" ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
115113
116114blockToZimWiki opts (Para inlines) = do
117115 indent <- gets stIndent
@@ -383,9 +381,7 @@ inlineToZimWiki opts (Image attr alt (source, tit)) = do
383381 ("", _, False ) -> "|" ++ alt'
384382 (_ , _, False ) -> "|" ++ tit
385383 (_ , _, True ) -> ""
386− -- Relative links fail isURI and receive a colon
387− prefix = if isURI source then "" else ":"
388− return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"
384+ return $ "{{" ++ source ++ imageDims opts attr ++ txt ++ "}}"
389385
390386inlineToZimWiki opts (Note contents) = do
391387 -- no concept of notes in zim wiki, use a text block
test/writer.zimwiki+2−2
@@ -593,9 +593,9 @@ or here: <http://example.com/>
593593
594594From “Voyage dans la Lune” by Georges Melies (1902):
595595
596−{{:lalune.jpg|Voyage dans la Lune lalune}}
596+{{lalune.jpg|Voyage dans la Lune lalune}}
597597
598−Here is a movie {{:movie.jpg|movie}} icon.
598+Here is a movie {{movie.jpg|movie}} icon.
599599
600600
601601----