diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-01-02 12:25:50 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-01-02 12:26:16 -0800 |
commit | 75695b18174d2184cbce73827e9f9d1b09dcb1de (patch) | |
tree | f285c10c1f50cc0ce0d9c4181ba9f57f633de187 /src/Text/Pandoc | |
parent | a68e072bac980394509930e0e6338b42f9fe0df5 (diff) | |
download | pandoc-75695b18174d2184cbce73827e9f9d1b09dcb1de.tar.gz |
MediaWiki reader: interpret markup inside `<tt>`, `<code>`.
Closes #2607.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/MediaWiki.hs | 10 |
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) |