summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/MediaWiki.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-01-19 11:24:19 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-19 11:24:19 +0100
commit06bdb8dbab1b8909e814d95afbe6b38ebff58c55 (patch)
tree2ce9edd279be6109afba0e812051f45e6c65bc97 /src/Text/Pandoc/Readers/MediaWiki.hs
parent5bd571f499baff36176f073bd3ab879114ad6890 (diff)
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/Pandoc/Readers/MediaWiki.hs')
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs5
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))