diff options
author | Timothy Humphries <tim@utf8.me> | 2014-11-09 00:35:29 -0500 |
---|---|---|
committer | Timothy Humphries <tim@utf8.me> | 2014-11-09 00:35:29 -0500 |
commit | ffae1567fdaf8b0fbd3d35b2718ff7e35c8cf75f (patch) | |
tree | 5b17fc5e37fa7ff41b40717632bff2b24894c721 | |
parent | 1cd65344b2c9fd1f905c52dc729ae17d03464322 (diff) |
DokuWiki writer: fix external images
Handles #1739. Preface relative links with ":", absolute URIs without.
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index 74418aa7e..eed45a965 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -134,7 +134,9 @@ blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do let opt = if null txt then "" else "|" ++ if null tit then capt else tit ++ capt - return $ "{{:" ++ src ++ opt ++ "}}\n" + -- Relative links fail isURI and receive a colon + prefix = if isURI src then "" else ":" + return $ "{{" ++ prefix ++ src ++ opt ++ "}}\n" blockToDokuWiki opts (Para inlines) = do indent <- stIndent <$> ask @@ -478,7 +480,9 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do ("", []) -> "" ("", _ ) -> "|" ++ alt' (_ , _ ) -> "|" ++ tit - return $ "{{:" ++ source ++ txt ++ "}}" + -- Relative links fail isURI and receive a colon + prefix = if isURI source then "" else ":" + return $ "{{" ++ prefix ++ source ++ txt ++ "}}" inlineToDokuWiki opts (Note contents) = do contents' <- blockListToDokuWiki opts contents |