stylist-2.4.0.2: Apply CSS styles to a document tree.
Safe HaskellNone
LanguageHaskell2010

Data.CSS.Syntax.StyleSheet

Description

Parses a CSS stylesheet See StyleSheet & parseForURL.

Synopsis

Documentation

parse :: StyleSheet s => s -> Text -> s Source #

Parse a CSS stylesheet

parse' :: StyleSheet t => t -> [Token] -> t Source #

Parse a tokenized (via `css-syntax`) CSS stylesheet

parseForURL :: StyleSheet s => s -> URI -> Text -> s Source #

Parse a CSS stylesheet, resolving all URLs to absolute form.

class StyleSheet s where Source #

Describes how to store, and to some extent parse, CSS stylesheets. These methods are used to construct the results from parse, etc.

Minimal complete definition

addRule

Methods

setPriority :: Int -> s -> s Source #

Sets the stylesheet priority (useragent vs user vs author), optional.

addRule :: s -> StyleRule -> s Source #

Stores a parsed selector+properties rule.

addAtRule :: s -> Text -> [Token] -> (s, [Token]) Source #

Stores and parses an identified at-rule.

Instances

Instances details
StyleSheet TrivialStyleSheet Source # 
Instance details

Defined in Data.CSS.Syntax.StyleSheet

StyleSheet StyleAssets Source # 
Instance details

Defined in Data.CSS.Preprocessor.Assets

StyleSheet s => StyleSheet (URIRewriter s) Source # 
Instance details

Defined in Data.CSS.Preprocessor.Assets

StyleSheet s => StyleSheet (LowerPsuedoClasses s) Source # 
Instance details

Defined in Data.CSS.Preprocessor.PsuedoClasses

PropertyParser p => StyleSheet (ConditionalStyles p) Source # 
Instance details

Defined in Data.CSS.Preprocessor.Conditions

(RuleStore s, PropertyParser p) => StyleSheet (QueryableStyleSheet' s p) Source # 
Instance details

Defined in Data.CSS.Style

skipAtRule :: [Token] -> [Token] Source #

Returns tokens after an at-rule, as per scanAtRule.

scanAtRule :: Parser [Token] Source #

Returns tokens before & after an at-rule value, terminated after a curly-bracketed block or a semicolon.

scanBlock :: Parser [Token] Source #

Returns tokens until the next unbalanced closing brace.

skipSpace :: [Token] -> [Token] Source #

Removes preceding Whitespace tokens.

data StyleRule Source #

The properties to set for elements matching the given selector.

Constructors

StyleRule Selector [(Text, [Token])] Text 

Instances

Instances details
Eq StyleRule Source # 
Instance details

Defined in Data.CSS.Syntax.StyleSheet

Show StyleRule Source # 
Instance details

Defined in Data.CSS.Syntax.StyleSheet

parseProperties :: Parser ([(Text, [Token])], Text) Source #

Parse "{key: value; ...}" property values, with a psuedoelement.

parseProperties' :: Parser [(Text, [Token])] Source #

Parse "key: value;"... property values, as per the HTML "style" property.

scanValue :: Parser [Token] Source #

Returns tokens before & after a semicolon.