diff options
author | damien clochard <damien@dalibo.info> | 2019-01-01 23:07:26 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-01-01 14:07:26 -0800 |
commit | 814e97df92bd3436e9bb3bf30728ef9822e35161 (patch) | |
tree | 4ff71ac45379a262678dd8b0821a5bfccd4f00a6 /src | |
parent | 2f92261d877c50d1909ae58c135700b35ffc111e (diff) | |
download | pandoc-814e97df92bd3436e9bb3bf30728ef9822e35161.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 8 |
1 files changed, 2 insertions, 6 deletions
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 |