aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclaremacrae <github@cfmacrae.fastmail.co.uk>2013-08-18 08:57:32 +0100
committerclaremacrae <github@cfmacrae.fastmail.co.uk>2013-08-18 08:57:32 +0100
commitb5b622f5b821ed5624b0ce2f29d1bddd0100bd04 (patch)
tree7dde99d1f43aba774edb34e65604ecc8e779f309
parent6d484bc55e2bc8d318b0727bcd88e4ceea795329 (diff)
downloadpandoc-b5b622f5b821ed5624b0ce2f29d1bddd0100bd04.tar.gz
Stop plain text // becoming an italic marker in dokuwiki writer (#386)
When the original document had text containing //, this was previously included, unchanged, in the dokuwiki output, and this interacted badly with later, intended, formating text.
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs5
-rw-r--r--tests/dokuwiki-writer.dokuwiki2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index a38a54953..4e7e79441 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -87,8 +87,7 @@ pandocToDokuWiki opts (Pandoc meta blocks) = do
-- | 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
+escapeString str = substitute "//" "%%//%%" str
-- | Convert Pandoc block element to DokuWiki.
blockToDokuWiki :: WriterOptions -- ^ Options
@@ -423,7 +422,7 @@ inlineToDokuWiki _ (Code _ str) =
-- any formatting inside inlined code blocks would be lost, or presented incorrectly.
return $ "''%%" ++ str ++ "%%''"
-inlineToDokuWiki _ (Str str) = return $ str
+inlineToDokuWiki _ (Str str) = return $ escapeString str
inlineToDokuWiki _ (Math _ str) = return $ "<math>" ++ str ++ "</math>"
-- note: str should NOT be escaped
diff --git a/tests/dokuwiki-writer.dokuwiki b/tests/dokuwiki-writer.dokuwiki
index 44f06f777..2e5d2fc1c 100644
--- a/tests/dokuwiki-writer.dokuwiki
+++ b/tests/dokuwiki-writer.dokuwiki
@@ -1,3 +1,3 @@
-hello // world ** from __ me
+hello %%//%% world ** from __ me
''%%hello // world ** from __ me%%''