@@ 42,14 42,19 @@ externalStyles html manager base = go $ linkedStyles html
linkedStyles (XML.Element "link" attrs _)
| Just link <- "href" `M.lookup` attrs,
Just "stylesheet" <- "rel" `M.lookup` attrs,
+ testMedia attrs,
Just uri <- parseURIReference $ unpack link = [uri]
linkedStyles (XML.Element _ _ children) =
concat [linkedStyles el | XML.NodeElement el <- children]
-internalStyles (XML.Element "style" _ children) = [strContent children]
+internalStyles (XML.Element "style" attrs children)
+ | testMedia attrs = [strContent children]
internalStyles (XML.Element _ _ children) =
concat [internalStyles el | XML.NodeElement el <- children]
+testMedia attrs = media == Nothing || media == Just "speech"
+ where media = "media" `M.lookup` attrs
+
strContent (XML.NodeContent text : rest) = unpack text ++ strContent rest
-- We do want to read in comments for CSS, just not for display.