~alcinnz/haskell-stylist

a833e105b78ac3949dedefa910753dfeddd0fca5 — Adrian Cochrane 4 years ago 3df8d43
Support lowering single-arg psuedoclasses.
1 files changed, 3 insertions(+), 0 deletions(-)

M src/Data/CSS/Preprocessor/PsuedoClasses.hs
M src/Data/CSS/Preprocessor/PsuedoClasses.hs => src/Data/CSS/Preprocessor/PsuedoClasses.hs +3 -0
@@ 34,5 34,8 @@ lowerSelector rewrites (Sibling sib sel') = Sibling sib $ lowerSelector' rewrite
lowerSelector' :: HashMap Text [Token] -> [SimpleSelector] -> [SimpleSelector]
lowerSelector' rewrites (Psuedoclass name []:sels)
    | Just value <- name `HM.lookup` rewrites = Psuedoclass "where" value : lowerSelector' rewrites sels
lowerSelector' rewrites (Psuedoclass name [arg]:sels)
    | Just value <- name `HM.lookup` rewrites =
        Psuedoclass "where" [if a == Ident "_" then arg else a | a <- value] : lowerSelector' rewrites sels
lowerSelector' rewrites (sel:sels) = sel : lowerSelector' rewrites sels
lowerSelector' _ [] = []