MediaWiki reader: Tightened up template parsing.
The opening "{{" must be followed by an alphanumeric or ':'.
This prevents the exponential slowdown in #1033.
Closes #1033.
commitd397a66107a932e702d0f9cbba5df3ce09be25fd
authorJohn MacFarlane <jgm@berkeley.edu>
dateFri 20 Jun 2014, 12:00 (12 years ago)
parent8f20ac3
src/Text/Pandoc/Readers/MediaWiki.hs+1
@@ -317,6 +317,7 @@ template :: MWParser String
317317template = try $ do
318318 string "{{"
319319 notFollowedBy (char '{')
320+ lookAhead $ letter <|> digit <|> char ':'
320321 let chunk = template <|> variable <|> many1 (noneOf "{}") <|> count 1 anyChar
321322 contents <- manyTill chunk (try $ string "}}")
322323 return $ "{{" ++ concat contents ++ "}}"