From 75695b18174d2184cbce73827e9f9d1b09dcb1de Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 2 Jan 2016 12:25:50 -0800 Subject: MediaWiki reader: interpret markup inside ``, ``. Closes #2607. --- src/Text/Pandoc/Readers/MediaWiki.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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) -- cgit v1.2.3