aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-07-24 21:42:32 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-07-24 21:43:24 -0700
commitc00f5c4372fabfcb30744aa85b1cc2b9142ea3e7 (patch)
tree55f49dd61fcab6b595fd3445f12e418a857dd5c8
parent1fb1cfb67014f93e96bdc379951b41a9d6ba27c6 (diff)
downloadpandoc-c00f5c4372fabfcb30744aa85b1cc2b9142ea3e7.tar.gz
HTML reader: Fixed bug in htmlBalanced.
This caused hangs in parsing certain markdown input using --strict.
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index d76524e14..87ce6277d 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -595,11 +595,10 @@ htmlInBalanced :: (Tag String -> Bool) -> Parser [Char] ParserState String
htmlInBalanced f = try $ do
(TagOpen t _, tag) <- htmlTag f
guard $ '/' `notElem` tag -- not a self-closing tag
- let nonTagChunk = many1 $ satisfy (/= '<')
let stopper = htmlTag (~== TagClose t)
let anytag = liftM snd $ htmlTag (const True)
contents <- many $ notFollowedBy' stopper >>
- (nonTagChunk <|> htmlInBalanced (const True) <|> anytag)
+ (htmlInBalanced f <|> anytag <|> count 1 anyChar)
endtag <- liftM snd stopper
return $ tag ++ concat contents ++ endtag