@@ -277,8 +277,9 @@ template :: MWParser String
277277template = try $ do
278278 string "{{"
279279 notFollowedBy (char '{')
280− contents <- manyTill anyChar (try $ string "}}")
281− return $ "{{" ++ contents ++ "}}"
280+ let chunk = template <|> variable <|> many1 (noneOf "{}") <|> count 1 anyChar
281+ contents <- manyTill chunk (try $ string "}}")
282+ return $ "{{" ++ concat contents ++ "}}"
282283
283284blockTag :: MWParser Blocks
284285blockTag = do
@@ -438,19 +439,18 @@ inline = whitespace
438439 <|> inlineTag
439440 <|> B.singleton <$> charRef
440441 <|> inlineHtml
441− <|> variable
442+ <|> (B.rawInline "mediawiki" <$> variable)
442443 <|> (B.rawInline "mediawiki" <$> template)
443444 <|> special
444445
445446str :: MWParser Inlines
446447str = B.str <$> many1 (noneOf $ specialChars ++ spaceChars)
447448
448−variable :: MWParser Inlines
449−variable = B.rawInline "mediawiki" <$> triplebrackets
450− where triplebrackets = try $ do
451− string "{{{"
452− contents <- manyTill anyChar (try $ string "}}}")
453− return $ "{{{" ++ contents ++ "}}}"
449+variable :: MWParser String
450+variable = try $ do
451+ string "{{{"
452+ contents <- manyTill anyChar (try $ string "}}}")
453+ return $ "{{{" ++ contents ++ "}}}"
454454
455455inlineTag :: MWParser Inlines
456456inlineTag = do
@@ -489,6 +489,7 @@ endline = () <$ try (newline <*
489489 notFollowedBy blankline <*
490490 notFollowedBy' hrule <*
491491 notFollowedBy tableStart <*
492+ notFollowedBy' header <*
492493 notFollowedBy' template <*
493494 notFollowedBy' (htmlTag isBlockTag') <*
494495 notFollowedBy anyListStart)