summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/MediaWiki.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-01-02 12:25:50 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-01-02 12:26:16 -0800
commit75695b18174d2184cbce73827e9f9d1b09dcb1de (patch)
treef285c10c1f50cc0ce0d9c4181ba9f57f633de187 /src/Text/Pandoc/Readers/MediaWiki.hs
parenta68e072bac980394509930e0e6338b42f9fe0df5 (diff)
MediaWiki reader: interpret markup inside `<tt>`, `<code>`.
Closes #2607.
Diffstat (limited to 'src/Text/Pandoc/Readers/MediaWiki.hs')
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index e423720df..d29ec50e7 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -370,8 +370,6 @@ preformatted = try $ do
manyTill anyChar (htmlTag (~== TagClose "nowiki")))
let inline' = whitespace' <|> endline' <|> nowiki'
<|> (try $ notFollowedBy newline *> inline)
- let strToCode (Str s) = Code ("",[],[]) s
- strToCode x = x
contents <- mconcat <$> many1 inline'
let spacesStr (Str xs) = all isSpace xs
spacesStr _ = False
@@ -379,6 +377,10 @@ preformatted = try $ do
then return mempty
else return $ B.para $ walk strToCode contents
+strToCode :: Inline -> Inline
+strToCode (Str s) = Code ("",[],[]) s
+strToCode x = x
+
header :: MWParser Blocks
header = try $ do
guardColumnOne
@@ -542,8 +544,8 @@ inlineTag = do
TagOpen "del" _ -> B.strikeout <$> inlinesInTags "del"
TagOpen "sub" _ -> B.subscript <$> inlinesInTags "sub"
TagOpen "sup" _ -> B.superscript <$> inlinesInTags "sup"
- TagOpen "code" _ -> B.code <$> charsInTags "code"
- TagOpen "tt" _ -> B.code <$> charsInTags "tt"
+ TagOpen "code" _ -> walk strToCode <$> inlinesInTags "code"
+ TagOpen "tt" _ -> walk strToCode <$> inlinesInTags "tt"
TagOpen "hask" _ -> B.codeWith ("",["haskell"],[]) <$> charsInTags "hask"
_ -> B.rawInline "html" . snd <$> htmlTag (~== tag)