From 06bdb8dbab1b8909e814d95afbe6b38ebff58c55 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 19 Jan 2017 11:24:19 +0100 Subject: MediaWiki reader: improved handling of display math. Sometimes display math is indented with more than one colon. Previously we handled these cases badly, generating definition lists and missing the math. Closes #3362. --- src/Text/Pandoc/Readers/MediaWiki.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index 76f111d53..0dea22c53 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -423,7 +423,8 @@ defListItem = try $ do terms <- mconcat . intersperse B.linebreak <$> many defListTerm -- we allow dd with no dt, or dt with no dd defs <- if B.isNull terms - then notFollowedBy (try $ string ":") *> + then notFollowedBy + (try $ skipMany1 (char ':') >> string "") *> many1 (listItem ':') else many (listItem ':') return (terms, defs) @@ -519,7 +520,7 @@ str :: MWParser Inlines str = B.str <$> many1 (noneOf $ specialChars ++ spaceChars) math :: MWParser Inlines -math = (B.displayMath . trim <$> try (char ':' >> charsInTags "math")) +math = (B.displayMath . trim <$> try (many1 (char ':') >> charsInTags "math")) <|> (B.math . trim <$> charsInTags "math") <|> (B.displayMath . trim <$> try (dmStart *> manyTill anyChar dmEnd)) <|> (B.math . trim <$> try (mStart *> manyTill (satisfy (/='\n')) mEnd)) -- cgit v1.2.3