From 6d484bc55e2bc8d318b0727bcd88e4ceea795329 Mon Sep 17 00:00:00 2001 From: claremacrae Date: Sun, 18 Aug 2013 08:13:34 +0100 Subject: Treat inline code blocks like instead of in dokuwiki writer (#386) Done because I noticed that in the Autolinks section of writer.dokuwiki, the URL in inlined code was getting auto-linked, when it wasn't supposed to. This also meant that any inline code examples that had text that looked like dokuwiki syntax could break the formatting of later text. --- src/Text/Pandoc/Writers/DokuWiki.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index 9ac35ebd6..a38a54953 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -412,7 +412,16 @@ inlineToDokuWiki opts (Quoted DoubleQuote lst) = do inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst inlineToDokuWiki _ (Code _ str) = - return $ "''" ++ ( escapeString str ) ++ "''" + -- In dokuwiki, text surrounded by '' is really just a font statement, i.e. , + -- and so other formatting can be present inside. + -- However, in pandoc, and markdown, inlined code doesn't contain formatting. + -- So I have opted for using %% to disable all formatting inside inline code blocks. + -- This gives the best results when converting from other formats to dokuwiki, even if + -- the resultand code is a little ugly, for short strings that don't contain formatting + -- characters. + -- It does mean that if pandoc could ever read dokuwiki, and so round-trip the format, + -- any formatting inside inlined code blocks would be lost, or presented incorrectly. + return $ "''%%" ++ str ++ "%%''" inlineToDokuWiki _ (Str str) = return $ str -- cgit v1.2.3