git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Fixed bug in htmlBalanced.

This caused hangs in parsing certain markdown input using --strict.

commitc00f5c4372fabfcb30744aa85b1cc2b9142ea3e7 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 24 Jul 2012, 21:42 (14 years ago) parent1fb1cfb
1 file changed+1−2
src/Text/Pandoc/Readers/HTML.hs+1−2
src/Text/Pandoc/Readers/HTML.hs+1−2
@@ -595,11 +595,10 @@ htmlInBalanced :: (Tag String -> Bool) -> Parser [Char] ParserState String
595595htmlInBalanced f = try $ do
596596 (TagOpen t _, tag) <- htmlTag f
597597 guard $ '/' `notElem` tag -- not a self-closing tag
598− let nonTagChunk = many1 $ satisfy (/= '<')
599598 let stopper = htmlTag (~== TagClose t)
600599 let anytag = liftM snd $ htmlTag (const True)
601600 contents <- many $ notFollowedBy' stopper >>
602− (nonTagChunk <|> htmlInBalanced (const True) <|> anytag)
601+ (htmlInBalanced f <|> anytag <|> count 1 anyChar)
603602 endtag <- liftM snd stopper
604603 return $ tag ++ concat contents ++ endtag
605604