git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Fixed bug in htmlBalanced.
c00f5c4John MacFarlane
src/Text/Pandoc/Readers/HTML.hs+1−2
@@ -595,11 +595,10 @@ htmlInBalanced :: (Tag String -> Bool) -> Parser [Char] ParserState String
595htmlInBalanced f = try $ do
595htmlInBalanced f = try $ do
596 (TagOpen t _, tag) <- htmlTag f
596 (TagOpen t _, tag) <- htmlTag f
597 guard $ '/' `notElem` tag -- not a self-closing tag
597 guard $ '/' `notElem` tag -- not a self-closing tag
598− let nonTagChunk = many1 $ satisfy (/= '<')
599 let stopper = htmlTag (~== TagClose t)
598 let stopper = htmlTag (~== TagClose t)
600 let anytag = liftM snd $ htmlTag (const True)
599 let anytag = liftM snd $ htmlTag (const True)
601 contents <- many $ notFollowedBy' stopper >>
600 contents <- many $ notFollowedBy' stopper >>
602− (nonTagChunk <|> htmlInBalanced (const True) <|> anytag)
601+ (htmlInBalanced f <|> anytag <|> count 1 anyChar)
603 endtag <- liftM snd stopper
602 endtag <- liftM snd stopper
604 return $ tag ++ concat contents ++ endtag
603 return $ tag ++ concat contents ++ endtag
605
604