html-conduit 1.1.0.4 → 1.1.0.5
raw patch · 3 files changed
+19/−1 lines, 3 files
Files
- Text/HTML/DOM.hs +4/−0
- html-conduit.cabal +1/−1
- test/main.hs +14/−0
Text/HTML/DOM.hs view
@@ -43,6 +43,10 @@ mx <- await case fmap (entities . fmap' (decodeUtf8With lenientDecode)) mx of Nothing -> closeStack stack++ -- Ignore processing instructions (or pseudo-instructions)+ Just (TS.TagOpen local _ _) | "?" `T.isPrefixOf` local -> go stack+ Just (TS.TagOpen local attrs isClosed) -> do let name = toName local attrs' = map (toName *** return . XT.ContentText) attrs
html-conduit.cabal view
@@ -1,5 +1,5 @@ Name: html-conduit-Version: 1.1.0.4+Version: 1.1.0.5 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. Homepage: https://github.com/snoyberg/xml
test/main.hs view
@@ -54,6 +54,20 @@ ] ] in H.parseLBS html @?= doc+ it "XHTML with doctype and <?xml #30" $ do+ let html = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html><head><title>foo</title></head><body><p>Hello World</p></body></html>"+ doc = X.Document (X.Prologue [] Nothing []) root []+ root = X.Element "html" Map.empty+ [ X.NodeElement $ X.Element "head" Map.empty+ [ X.NodeElement $ X.Element "title" Map.empty+ [X.NodeContent "foo"]+ ]+ , X.NodeElement $ X.Element "body" Map.empty+ [ X.NodeElement $ X.Element "p" Map.empty+ [X.NodeContent "Hello World"]+ ]+ ]+ in H.parseLBS html @?= doc it "HTML" $ let html = "<html><head><title>foo</title></head><body><br><p>Hello World</p></body></html>" doc = X.Document (X.Prologue [] Nothing []) root []