@@ 68,6 68,13 @@ parseCue [Ident "none"] = Just NoCue
parseCue _ = Nothing
data StyleLeaf = Content {value :: Text} | Counter Text | Counters Text Text deriving Eq
+parseContent (String txt:toks) = (\val -> Content txt : val) <$> parseContent toks
+parseContent (Function "counter" : Ident c : LeftParen : toks) =
+ (\val -> Counter c : val) <$> parseContent toks
+parseContent (Function "counters" : Ident c : Comma : String sep : LeftParen : toks) =
+ (\val -> Counters c sep : val) <$> parseContent toks
+parseContent [] = Just []
+parseContent _ = Nothing
parseCounters _ [Ident "none"] = Just []
parseCounters _ [] = Just []
@@ 201,10 208,7 @@ instance Style.PropertyParser StyleTree where
longhand _ self "cue-before" toks = (\val -> self {cueBefore = val}) <$> parseCue toks
longhand _ self "cue-after" toks = (\val -> self {cueAfter = val}) <$> parseCue toks
- longhand _ self "content" [String txt] = Just self {content = [Content txt]}
- longhand _ self "content" [Function "counter", Ident c, LeftParen] = Just self {content = [Counter c]}
- longhand _ self "content" [Function "counters", Ident c, Comma, String sep, LeftParen] =
- Just self {content = [Counters c sep]}
+ longhand _ self "content" toks = (\val -> self {content = val}) <$> parseContent toks
longhand _ self "counter-reset" toks = (\val -> self {counterReset = val}) <$> parseCounters 0 toks
longhand _ self "counter-increment" toks = (\val -> self {counterIncrement = val}) <$> parseCounters 1 toks