From 814e97df92bd3436e9bb3bf30728ef9822e35161 Mon Sep 17 00:00:00 2001 From: damien clochard Date: Tue, 1 Jan 2019 23:07:26 +0100 Subject: 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 --- src/Text/Pandoc/Writers/DokuWiki.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index 28426af67..5992857cc 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -130,9 +130,7 @@ blockToDokuWiki 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" blockToDokuWiki opts (Para inlines) = do indent <- asks stIndent @@ -516,9 +514,7 @@ inlineToDokuWiki opts (Image attr alt (source, tit)) = do ("", []) -> "" ("", _ ) -> "|" ++ alt' (_ , _ ) -> "|" ++ tit - -- 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 ++ "}}" inlineToDokuWiki opts (Note contents) = do contents' <- blockListToDokuWiki opts contents -- cgit v1.2.3