DokuWiki writer: fix external images

Handles #1739. Preface relative links with ":", absolute URIs without.
This commit is contained in:
Timothy Humphries 2014-11-09 00:35:29 -05:00
parent 1cd65344b2
commit ffae1567fd

View file

@ -134,7 +134,9 @@ blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
let opt = if null txt let opt = if null txt
then "" then ""
else "|" ++ if null tit then capt else tit ++ capt 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 blockToDokuWiki opts (Para inlines) = do
indent <- stIndent <$> ask indent <- stIndent <$> ask
@ -478,7 +480,9 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do
("", []) -> "" ("", []) -> ""
("", _ ) -> "|" ++ alt' ("", _ ) -> "|" ++ alt'
(_ , _ ) -> "|" ++ tit (_ , _ ) -> "|" ++ 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 inlineToDokuWiki opts (Note contents) = do
contents' <- blockListToDokuWiki opts contents contents' <- blockListToDokuWiki opts contents