html-conduit 1.3.1 → 1.3.2
raw patch · 4 files changed
+30/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- html-conduit.cabal +1/−1
- src/Text/HTML/TagStream.hs +1/−1
- test/main.hs +24/−2
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.3.2++* Fix a bug that was removing `<` symbols in script tags.+ ## 1.3.1 * Inline tagstream-conduit for entity decoding in attribute value bug
html-conduit.cabal view
@@ -1,5 +1,5 @@ Name: html-conduit-Version: 1.3.1+Version: 1.3.2 Synopsis: Parse HTML documents using xml-conduit datatypes. Description: This package uses tagstream-conduit for its parser. It automatically balances mismatched tags, so that there shouldn't be any parse failures. It does not handle a full HTML document rendering, such as adding missing html and head tags. Note that, since version 1.3.1, it uses an inlined copy of tagstream-conduit with entity decoding bugfixes applied. Homepage: https://github.com/snoyberg/xml
src/Text/HTML/TagStream.hs view
@@ -167,7 +167,7 @@ chunk <- takeTill (== '<') let acc' = acc <> B.fromText chunk finish = pure [open, Text $ L.toStrict $ B.toLazyText acc', TagClose "script"]- hasContent = (string "/script>" *> finish) <|> loop acc'+ hasContent = (string "/script>" *> finish) <|> loop (acc' <> "<") (char '<' *> hasContent) <|> finish tokens :: Parser [Token]
test/main.hs view
@@ -120,9 +120,9 @@ describe "script tags" $ do it "ignores funny characters" $- let html = "<script>hello > world</script>"+ let html = "<script>hello <> world</script>" doc = X.Document (X.Prologue [] Nothing []) root []- root = X.Element "script" Map.empty [X.NodeContent "hello > world"]+ root = X.Element "script" Map.empty [X.NodeContent "hello <> world"] in H.parseLBS html @?= doc {-@@ -152,3 +152,25 @@ in H.parseLBS html @?= doc prop "parses all random input" $ \strs -> void $ evaluate $!! H.parseSTChunks $ map T.pack strs++ describe "#128 entities cut off" $ do+ it "reported issue" $ do+ let html = "<a href=\"https://example.com?a=b&c=d\">link</a>"+ doc = X.Document (X.Prologue [] Nothing []) root []+ root = X.Element+ "a"+ (Map.singleton "href" "https://example.com?a=b&c=d")+ [X.NodeContent "link"]+ in H.parseLBS html @?= doc++ it "from test suite" $ do+ let html = "<a class=\"u-url\" href=\"https://secure.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&d=blank&r=g\">link</a>"+ doc = X.Document (X.Prologue [] Nothing []) root []+ root = X.Element+ "a"+ (Map.fromList+ [ ("href", "https://secure.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&d=blank&r=g")+ , ("class", "u-url")+ ])+ [X.NodeContent "link"]+ in H.parseLBS html @?= doc