ANN: cssutils 0.9.6b3

Christof Hoeke cthedot at gmail.com
Sun Aug 2 19:16:48 CEST 2009


what is it
----------
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)

about this release
------------------
0.9.6b3 adds a few features and fixes quite a few bugs.

main changes
------------
     + **FEATURE**: Added parsing support and new profile for details 
defined in module Fonts http://www.w3.org/TR/css3-fonts/

     + **FEATURE**: Added ``cssutils.parseStyle(cssText, 
encoding='utf-8')`` convienience function

     + **FEATURE** (experimental, request from issue #27): Added 
``css.CSSStyleDeclaration.children()`` which is a generator yielding any 
known children of a declaration including *all* properties, comments or 
CSSUnknownRules.

     + FEATURE: ``CSSStyleDeclaration.insertRule`` also accepts a 
``CSSRuleList`` now (same as ``CSSStyleSheet`` which does this for some 
time now).

     + FEATURE: Added ``CSSStyleDeclaration.keys()`` method which 
analoguous to standard dict returns property names which are set in the 
declaration.

     - **API CHANGE**: Replaced attribute ``css.Property.parentStyle`` 
with ``css.Property.parent`` (``parentStyle`` is DEPRECATED now).

     + **BUGFIX**: Improved child and parent node referencing.

     + **BUGFIX**: Parsing of CSSValues with unknown function names with 
a specific length of 4 or 7 chars were resulting in a SyntaxErr. Also 
parsing of comma separated list of CSS FUNCTION values works now.

     + BUGFIX: Fixed validation problems:
         - ``font-family: a   b`` (values with spaces in names without 
being quoted) are parsed now without emitting an ERROR. These are indeed 
valid but discouraged and you should use quotes (more than one space is 
compacted to a single space anyway so rather complicated without quotes)
         - negative lengths for the ``font-size`` property are now 
properly reported as ERRORs

     - IMPROVEMENT (minor): cssutils sets the HTTP header ``User-Agent`` 
now when fetching sheets over HTTP (with e.g. ``cssutils.parseUrl``).

     - *FEATURE* (experimental): Added support to at least parse sheets 
with Microsoft only property values for ``filter`` which start with 
``progid:DXImageTransform.Microsoft.[...](``. To enable these you need 
to set::

             >>> from cssutils import settings
             >>> settings.set('DXImageTransform.Microsoft', True)
             >>> cssutils.ser.prefs.useMinified()
             >>> text = 'a {filter: 
progid:DXImageTransform.Microsoft.BasicImage( rotation = 90 )}'
             >>> print cssutils.parseString(text).cssText
 
a{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=90)}
             >>>

       This currently is a **major hack** but if you like to minimize 
sheets in the wild which use this kind of CSS cssutils at least can 
parse and reserialize them.

license
-------
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/

If you have other licensing needs please let me know.

download
--------
For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2, 
2.4.4 and Jython 2.5 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.

Christof


More information about the Python-announce-list mailing list