From d397a66107a932e702d0f9cbba5df3ce09be25fd Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Fri, 20 Jun 2014 12:00:26 -0700
Subject: [PATCH] MediaWiki reader: Tightened up template parsing.

The opening "{{" must be followed by an alphanumeric or ':'.
This prevents the exponential slowdown in #1033.
Closes #1033.
---
 src/Text/Pandoc/Readers/MediaWiki.hs | 1 +
 1 file changed, 1 insertion(+)

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 ++ "}}"