diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-06-20 12:00:26 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-06-20 12:00:26 -0700 |
commit | d397a66107a932e702d0f9cbba5df3ce09be25fd (patch) | |
tree | ad51f10f4513cf128c8f250036424f433b137ab9 | |
parent | 8f20ac3da3b0d1111f94161d5b3528dfa94d1069 (diff) | |
download | pandoc-d397a66107a932e702d0f9cbba5df3ce09be25fd.tar.gz |
MediaWiki reader: Tightened up template parsing.
The opening "{{" must be followed by an alphanumeric or ':'.
This prevents the exponential slowdown in #1033.
Closes #1033.
-rw-r--r-- | src/Text/Pandoc/Readers/MediaWiki.hs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index eb9dd5b8a..f1dcce8f7 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -317,6 +317,7 @@ template :: MWParser String template = try $ do string "{{" notFollowedBy (char '{') + lookAhead $ letter <|> digit <|> char ':' let chunk = template <|> variable <|> many1 (noneOf "{}") <|> count 1 anyChar contents <- manyTill chunk (try $ string "}}") return $ "{{" ++ concat contents ++ "}}" |