tinycss: a new CSS parser for Python

Hi www-style,

I’m happy to announce the first release of tinycss, a complete yet 
simple CSS parser for Python. It supports the full syntax and error 
handling for CSS 2.1 as well as some CSS 3 modules:

* Selectors 3 (can also find matching elements in a lxml document)
* CSS Color 3
* CSS Paged Media 3

It is designed to be easy to extend for new CSS modules and syntax.

Documentation: http://packages.python.org/tinycss/
Source: https://github.com/SimonSapin/tinycss/

The API is not based on SAC or CSSOM, but rather on what I felt was 
useful for WeasyPrint and CairoSVG (rendering engines for HTML and SVG 
respectively, that both support CSS).

I made the choice not to parse property values: each UA will support a 
different set of properties and values, they need to filter unsupported 
declarations themselves to have proper fallback.

Anyway. Source code, tests and documentation are available. Any feedback 
is appreciated.

Thanks,
-- 
Simon Sapin

Received on Thursday, 5 April 2012 18:23:37 UTC