Package cssutils
[hide private]
[frames] | no frames]

Package cssutils

source code

cssutils - CSS Cascading Style Sheets library for Python

Copyright (C) 2004-2007 Christof Hoeke

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

A Python package to parse and build CSS Cascading Style Sheets. Partly implements the DOM Level 2 Stylesheets and DOM Level 2 CSS interfaces.

Please visit http://cthedot.de/cssutils/ for full details and updates.

Tested with Python 2.5 on Windows XP.

This package is optimized for usage of from cssutils import * which import subpackages css and stylesheets, the CSSParser and CSSSerializer classes only.

Usage may be:

>>> from cssutils import *
>>> parser = CSSParser()
>>> sheet = parser.parseString(u'a { color: red}')
>>> print sheet.cssText



Version: 0.9.2b1 $LastChangedRevision: 177 $

Date: $LastChangedDate: 2007-08-06 18:33:45 +0200 (Mo, 06 Aug 2007) $

Author: $LastChangedBy: doerwalter $

Submodules [hide private]

Classes [hide private]
  CSSParser
parses a CSS StyleSheet string or file and returns a DOM Level 2 CSS StyleSheet object
  CSSSerializer
Methods to serialize a CSSStylesheet and its parts
Functions [hide private]
 
parse(filename, encoding=None, href=None, media=None)
reads file with given filename in given encoding (if given) and returns CSSStyleSheet object
source code
 
parseString(cssText, href=None, media=None)
parses given string and returns CSSStyleSheet object
source code
 
setSerializer(serializer)
sets the global serializer used by all class in cssutils
source code
Variables [hide private]
  log = errorhandler.ErrorHandler()
  ser = CSSSerializer()

Imports: cssutils.tokenize, cssutils.errorhandler, cssutils.serialize, cssutils.token, cssutils.util