@@ 27,10 27,8 @@ main = do
-- TODO support more URI schemes, and do nonblocking networking. This could be it's own module.
request <- HTTP.parseRequest url
manager <- HTTP.newManager TLS.tlsManagerSettings
- putStrLn "Loading page..."
response <- HTTP.httpLbs request manager
let html = XML.documentRoot $ HTML.parseLBS $ HTTP.responseBody response
- putStrLn "Loaded page!"
style <- retreiveStyles html manager request
C8.putStrLn $ renderElLBS $ stylizeEl style html
@@ 62,7 60,7 @@ externalStyles html manager base = go $ linkedStyles html
return (Txt.pack (C8.unpack $ HTTP.responseBody response) : rest)
go [] = return []
-linkedStyles (XML.Element "link" attrs _)
+linkedStyles (XML.Element (XML.Name "link" _ _) attrs _)
| Just link <- "href" `M.lookup` attrs,
Just "stylesheet" <- "rel" `M.lookup` attrs,
testMedia attrs,
@@ 70,7 68,7 @@ linkedStyles (XML.Element "link" attrs _)
linkedStyles (XML.Element _ _ children) =
concat [linkedStyles el | XML.NodeElement el <- children]
-internalStyles (XML.Element "style" attrs children)
+internalStyles (XML.Element (XML.Name "style" _ _) attrs children)
| testMedia attrs = [strContent children]
internalStyles (XML.Element _ _ children) =
concat [internalStyles el | XML.NodeElement el <- children]