diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index 3f4efb1b3..9ac35ebd6 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -85,6 +85,11 @@ pandocToDokuWiki opts (Pandoc meta blocks) = do then return $ renderTemplate' (writerTemplate opts) context else return main +-- | Escape special characters for MediaWiki. +escapeString :: String -> String +-- The spaces around // are to prevent touching in URLs inside inline code blocks +escapeString str = substitute " // " " %%//%% " str + -- | Convert Pandoc block element to DokuWiki. blockToDokuWiki :: WriterOptions -- ^ Options -> Block -- ^ Block element @@ -407,7 +412,7 @@ inlineToDokuWiki opts (Quoted DoubleQuote lst) = do inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst inlineToDokuWiki _ (Code _ str) = - return $ "''" ++ str++ "''" + return $ "''" ++ ( escapeString str ) ++ "''" inlineToDokuWiki _ (Str str) = return $ str |