~alcinnz/rhapsode

12fc781ec61a9cecf0000fe4a32965e8ce525b82 — Adrian Cochrane 3 years ago 32909aa
Better label rel=stylesheet
1 files changed, 8 insertions(+), 2 deletions(-)

M src/Links.hs
M src/Links.hs => src/Links.hs +8 -2
@@ 60,9 60,15 @@ extractEl _ (Element "{https://specifications.freedesktop.org/metainfo/1.0}url" 
    | Just label <- "{https://specifications.freedesktop.org/metainfo/1.0}type" `M.lookup` attrs,
      Just url <- parseAbsoluteURI $ unpack $ nodesText childs "" = [Link label "" url]
extractEl _ el@(Element _ attrs [])
    | Just "alternae" <- "rel" `M.lookup` attrs', Just typ <- "type" `M.lookup` attrs',
    | Just "alternate" <- "rel" `M.lookup` attrs', Just typ <- "type" `M.lookup` attrs',
            Just val <- "href" `M.lookup` attrs', Just uri <- parseURIReference $ unpack val =
        let Application name _ title _ = mimeInfoCached $ unpack typ
        let Application name _ title _ = mimeInfo $ unpack typ
        in [Link (pack name) (pack title) uri]
  where attrs' = M.mapKeys nameLocalName attrs
extractEl _ el@(Element (Name "link" _ _) attrs [])
    | Just "stylesheet" <- "rel" `M.lookup` attrs', Nothing <- "title" `M.lookup` attrs',
            Just val <- "href" `M.lookup` attrs', Just uri <- parseURIReference $ unpack val =
        let Application name _ title _ = mimeInfo "text/css"
        in [Link (pack name) (pack title) uri]
  where attrs' = M.mapKeys nameLocalName attrs
extractEl path el@(Element _ _ children) =