Modules such as .page3
extend the CSS 2.1 parser to add support for CSS 3 syntax. They do so by sub-classing .css21.CSS21Parser
and overriding/extending some of its methods. If fact, the parser is made of methods in a class (rather than a set of functions) solely to enable this kind of sub-classing.
tinycss is designed to enable you to have parser subclasses outside of tinycss, without monkey-patching. If however the syntax you added is for a W3C specification, consider including your subclass in a new tinycss module and send a pull request: see hacking
.
tinycss.css21
In addition to methods of the user API (see parsing
), here are the methods of the CSS 2.1 parser that can be overriden or extended:
CSS21Parser.parse_rules
CSS21Parser.read_at_rule
CSS21Parser.parse_at_rule
CSS21Parser.parse_media
CSS21Parser.parse_page_selector
CSS21Parser.parse_declarations_and_at_rules
CSS21Parser.parse_ruleset
CSS21Parser.parse_declaration_list
CSS21Parser.parse_declaration
CSS21Parser.parse_value_priority
AtRule
tinycss.parsing
The tinycss.parsing
module contains helper functions for parsing tokens into a more structured form:
strip_whitespace
split_on_comma
validate_value
validate_block
validate_any