diff --git a/src/Text/Taggy/Parser.hs b/src/Text/Taggy/Parser.hs index e7dc2cc..19b49e1 100644 --- a/src/Text/Taggy/Parser.hs +++ b/src/Text/Taggy/Parser.hs @@ -117,7 +117,7 @@ tagclose = do char '/' skipSpace i <- ident - char '>' + possibly '>' return $ TagClose i tagtext :: Bool -> Parser Tag diff --git a/tests/Text/Taggy/ParserSpec.hs b/tests/Text/Taggy/ParserSpec.hs index 7d1381a..ab10500 100644 --- a/tests/Text/Taggy/ParserSpec.hs +++ b/tests/Text/Taggy/ParserSpec.hs @@ -96,6 +96,14 @@ spec = do , TagClose "body" , TagClose "html" ] + it "doesn't choke on malformed closing tags" $ + "North Korea htmlWith False + `shouldParse` [ TagOpen "strong" [] False + , TagText "North Korea" + , TagClose "strong" + , TagText "." + ] + (~>) :: Text -> Parser a -> Either String a (~>) = (Test.Hspec.Attoparsec.Source.~>)