ANN: cssutils 0.9.5b3
Christof Hoeke
cthedot at gmail.com
Fri Jun 6 22:20:19 CEST 2008
what is it
----------
A Python package to parse and build CSS Cascading Style Sheets. (Not a
renderer though!)
main changes
------------
0.9.5b3
- **API CHANGE**: ``parse()`` is *DEPRECATED*, use ``parseFile()``
instead. I know this should not happen in a release already in beta but
better now than later and currently both ways are still possible.
- **FEATURE'**: CSSStyleDeclatation objects may be used like
dictionaries now. The value during setting a property may be a single
value string or a tuple of ``(value, priority)``
- **FEATURE**: While reading an imported styleSheet all relevant
encoding parameters (HTTP headers, BOM/@charset, etc) are used now as
defined in http://www.w3.org/TR/CSS21/syndata.html#charset
Additionally a given parameter ``encoding`` for
``parseString``, ``parseFile`` and ``parseUrl`` functions/methods
**overrides** any detected encoding of read sheet like HTTP information
or @charset rules. Useful if e.g. HTTP information is not set properly.
The given ``encoding`` is used for **all** imported sheets of the parsed
one too! This is a cssutils only addition to the rules defined at
http://www.w3.org/TR/CSS21/syndata.html#charset.
- **FEATURE**: A custom URL fetcher may be used during parsing via
``CSSParser.setFetcher(fetcher)`` (or as an init parameter). The so
customized parser is reusable (as all parsers are). The fetcher is
called when an ``@import`` rule is found and the referenced stylesheet
is about to be retrieved.
- **FEATURE**: Added option ``-s --string`` to cssparse script
which expects a CSS string to be parsed.
- **FEATURE/BUGFIX**: Parsing of CSSStyleDeclarations is improved.
Invalid ``/color: red;color: green`` is now correctly parsed as ``color:
green`` now. At the same time the until now parsed but invalid ``$color:
red`` (an IE hack) is not parse anymore but correctly dismissed!
Unknown rules in CSSStyleDeclaration are parsed now. So e.g ``@x;
color: red;`` which is syntactically valid is kept completely.
- **LICENSE**: cssutils is licensed under the **LGPL v3** now
(before LGPL v2.1). This should not be a problem I guess but please be
aware. So the former mix of LGPL 2.1 and 3 is resolved to a single LGPL
3 license for both cssutils and the included encutils.
- a few other changes, bugfixes and improvements
Note:
CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant
methods/properties Property.cssValue and
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and
will probably be replaced with interfaces defined in CSSOM. For now use
the properties and methods that handle values as simple strings, e.g.
``Property.value``. As the aforementioned classes are not hardly that
useful anyway this should not be a big problem but please beware if you
use or have used them.
If you think this a bad idea please let me know!
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.5.2 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