aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-20 12:00:26 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-20 12:00:26 -0700
commitd397a66107a932e702d0f9cbba5df3ce09be25fd (patch)
treead51f10f4513cf128c8f250036424f433b137ab9 /src/Text/Pandoc/Readers
parent8f20ac3da3b0d1111f94161d5b3528dfa94d1069 (diff)
downloadpandoc-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.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs1
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 ++ "}}"