From 36872a78ccd8fb2d5646a475e5da8e9a84f2b3c8 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sun, 14 Jul 2019 18:02:17 +1200 Subject: [PATCH] Correctly match tagnames (syntax error). How did this regress? --- src/Main.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index d35e46f..7f9251c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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] -- 2.30.2