[Web-SIG] CSS parsers: prior art

Simon Willison cs1spw at bath.ac.uk
Fri Oct 24 23:59:11 EDT 2003


I just had a look around for prior art of libraries that handle CSS 
parsing for languages other than Python.

Perl has a number of interesting modules for handling CSS in CPAN:

CSS-Tiny
http://search.cpan.org/~adamk/CSS-Tiny-1.02/lib/CSS/Tiny.pm

This module provides a small, light weight object oriented style API for 
reading and writing CSS files "with as little code as possible". It 
seems like it would map to a nicely Pythonic simple module that makes 
use of operator overloading.

CSS 1.05
http://search.cpan.org/~iamcal/CSS-1.05/CSS.pm

This is	a large, object oriented library that appears to provide access 
to a variety of alternative parsers and formatters. The basic principle 
involves converting CSS declarations in to an object tree.

CSS-SAC
http://search.cpan.org/~rberjon/CSS-SAC-0.05/SAC.pm

This is an event based CSS parser modelled on the W3C's Simple API for 
CSS: http://www.w3.org/TR/SAC/

Also of interest is the W3C's DOM specification for styling:

http://www.w3.org/TR/DOM-Level-2-Style/

It seems we are spoilt for choice when it comes to picking an API to 
base a Python CSS module on.

-- 
Simon Willison
Web development weblog: http://simon.incutio.com/




More information about the Web-SIG mailing list