mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-26 17:35:49 +00:00
MediaWiki reader: Tightened up template parsing.
The opening "{{" must be followed by an alphanumeric or ':'.
This prevents the exponential slowdown in #1033.
Closes #1033.
This commit is contained in:
@@ -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 ++ "}}"
|
||||
|
||||
Reference in New Issue
Block a user