M src/Data/CSS/Preprocessor/Text.hs => src/Data/CSS/Preprocessor/Text.hs +1 -0
@@ 82,6 82,7 @@ instance PropertyParser p => PropertyParser (TextStyle p) where
afterPseudo = Nothing,
markerPseudo = Nothing
}
+ priority self = priority $ inner self
shorthand _ key value
| key `elem` ["counter-reset", "counter-increment", "counter-set"],
M src/Data/CSS/Preprocessor/Text/CounterStyle.hs => src/Data/CSS/Preprocessor/Text/CounterStyle.hs +5 -3
@@ 201,11 201,12 @@ fallbackSym :: Text
fallbackSym = "\0"
counterRenderCore :: CounterStyle -> Int -> Text
-counterRenderCore CounterStyle { system = Cyclic, symbols = syms } x =
- syms !! (pred x `rem` length syms)
counterRenderCore CounterStyle { system = Fixed n, symbols = syms } x
- | x - n < length syms = syms !! (x - n)
+ | x - n < length syms && x >= n = syms !! (x - n)
| otherwise = fallbackSym
+counterRenderCore _ x | x < 0 = fallbackSym
+counterRenderCore CounterStyle { system = Cyclic, symbols = syms } x =
+ syms !! (pred x `rem` length syms)
counterRenderCore CounterStyle { system = Symbolic, symbols = syms } x =
succ (quot x' n) `Txt.replicate` (syms !! rem x' n)
where (n, x') = (length syms, pred x)
@@ 314,6 315,7 @@ counterRender self@CounterStyle { fallback = Just self' } x
| otherwise = inRange y rest
inRange _ [] = False
counterRender self@CounterStyle { padLength = m, padChar = pad } x
+ | Fixed _ <- system self = text -- Handles negatives specially here.
| x < 0 = Txt.concat [
negativePrefix self,
counterRender self { ranges = Just [(0, maxBound)] } $ -x, -- No fallback!