diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-01-19 11:24:19 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-01-19 11:24:19 +0100 |
commit | 06bdb8dbab1b8909e814d95afbe6b38ebff58c55 (patch) | |
tree | 2ce9edd279be6109afba0e812051f45e6c65bc97 /src/Text | |
parent | 5bd571f499baff36176f073bd3ab879114ad6890 (diff) | |
download | pandoc-06bdb8dbab1b8909e814d95afbe6b38ebff58c55.tar.gz |
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.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/MediaWiki.hs | 5 |
1 files changed, 3 insertions, 2 deletions
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 ":<math>") *> + then notFollowedBy + (try $ skipMany1 (char ':') >> string "<math>") *> 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)) |