git.iko.soy/typeable/pandoc
on master help sign in
Dokuwiki writer: remove automatic ':' prefix before internal image links (#5183)

* FIX #5183 : remove automatic ':' prefix before internal image links `![](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. It blocks users from making relative image links. Update tests for DokuWiki Writer : external images

commit814e97df92bd3436e9bb3bf30728ef9822e35161 authordamien clochard <damien@dalibo.info> dateTue 1 Jan 2019, 23:07 (8 years ago) parent2f92261
3 files changed+5−9
src/Text/Pandoc/Writers/DokuWiki.hs+2−6 test/dokuwiki_external_images.dokuwiki+1−1 test/writer.dokuwiki+2−2
src/Text/Pandoc/Writers/DokuWiki.hs+2−6
@@ -130,9 +130,7 @@ blockToDokuWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
130130 let opt = if null txt
131131 then ""
132132 else "|" ++ if null tit then capt else tit ++ capt
133− -- Relative links fail isURI and receive a colon
134− prefix = if isURI src then "" else ":"
135− return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
133+ return $ "{{" ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
136134
137135blockToDokuWiki opts (Para inlines) = do
138136 indent <- asks stIndent
@@ -516,9 +514,7 @@ inlineToDokuWiki opts (Image attr alt (source, tit)) = do
516514 ("", []) -> ""
517515 ("", _ ) -> "|" ++ alt'
518516 (_ , _ ) -> "|" ++ tit
519− -- Relative links fail isURI and receive a colon
520− prefix = if isURI source then "" else ":"
521− return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"
517+ return $ "{{" ++ source ++ imageDims opts attr ++ txt ++ "}}"
522518
523519inlineToDokuWiki opts (Note contents) = do
524520 contents' <- blockListToDokuWiki opts contents
test/dokuwiki_external_images.dokuwiki+1−1
@@ -1 +1 @@
1−{{https://cooluri.com/image.png|HTTPS image}} {{http://cooluri.com/image.png|HTTP image}} {{ftp://ftp.cooluri.com/image.png|FTP image}} {{file:///tmp/coolimage.png|Filesystem image}} {{:/image.jpg|Relative image 1}} {{:image.jpg|Relative image 2}}
1+{{https://cooluri.com/image.png|HTTPS image}} {{http://cooluri.com/image.png|HTTP image}} {{ftp://ftp.cooluri.com/image.png|FTP image}} {{file:///tmp/coolimage.png|Filesystem image}} {{/image.jpg|Relative image 1}} {{image.jpg|Relative image 2}}
test/writer.dokuwiki+2−2
@@ -609,9 +609,9 @@ or here: <http://example.com/>
609609
610610From “Voyage dans la Lune” by Georges Melies (1902):
611611
612−{{:lalune.jpg|Voyage dans la Lune lalune}}
612+{{lalune.jpg|Voyage dans la Lune lalune}}
613613
614−Here is a movie {{:movie.jpg|movie}} icon.
614+Here is a movie {{movie.jpg|movie}} icon.
615615
616616
617617----