W3C home > Mailing lists > Public > www-style@w3.org > April 2012

tinycss: a new CSS parser for Python

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Thu, 05 Apr 2012 20:23:09 +0200
Message-ID: <4F7DE30D.5000301@kozea.fr>
To: www-style@w3.org
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.

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

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:35:07 UTC