Package cssutils :: Module serialize :: Class CSSSerializer
[hide private]
[frames] | no frames]

Class CSSSerializer

source code

object --+
         |
        CSSSerializer

Methods to serialize a CSSStylesheet and its parts

To use your own serializing method the easiest is to subclass CSS Serializer and overwrite the methods you like to customize.



Instance Methods [hide private]
 
__notinurimatcher(...)
match(string[, pos[, endpos]]) --> match object or None.
source code
 
__init__(self, prefs=None)
instance of Preferences
source code
 
_serialize(self, text) source code
 
_noinvalids(self, x) source code
 
_valid(self, x)
checks if valid items only and if yes it item is valid
source code
 
_wellformed(self, x)
checks if wellformed items only and if yes it item is wellformed
source code
 
_escapestring(self, s, delim=u'"')
escapes delim charaters in string s with delim
source code
 
_getatkeyword(self, rule, default)
used by all @rules to get the keyword used dependent on prefs setting defaultAtKeyword
source code
 
_getpropertyname(self, property, actual)
used by all styledeclarations to get the propertyname used dependent on prefs setting defaultPropertyName
source code
 
_indentblock(self, text, level)
indent a block like a CSSStyleDeclaration to the given level which may be higher than self._level (e.g.
source code
 
_uri(self, uri)
returns uri enclosed in " if necessary
source code
 
do_stylesheets_mediaquery(self, mediaquery)
a single media used in medialist
source code
 
do_stylesheets_medialist(self, medialist)
comma-separated list of media, default is 'all'
source code
 
do_CSSStyleSheet(self, stylesheet) source code
 
do_CSSComment(self, rule)
serializes CSSComment which consists only of commentText
source code
 
do_CSSCharsetRule(self, rule)
serializes CSSCharsetRule encoding: string
source code
 
do_CSSFontFaceRule(self, rule)
serializes CSSFontFaceRule
source code
 
do_CSSImportRule(self, rule)
serializes CSSImportRule
source code
 
do_CSSNamespaceRule(self, rule)
serializes CSSNamespaceRule
source code
 
do_CSSMediaRule(self, rule)
serializes CSSMediaRule
source code
 
do_CSSPageRule(self, rule)
serializes CSSPageRule
source code
 
do_pageselector(self, seq)
a selector of a CSSPageRule including comments
source code
 
do_CSSUnknownRule(self, rule)
serializes CSSUnknownRule anything until ";" or "{...}" + CSSComments
source code
 
do_CSSStyleRule(self, rule)
serializes CSSStyleRule
source code
 
do_css_SelectorList(self, selectorlist)
comma-separated list of Selectors
source code
 
do_css_Selector(self, selector)
a single selector including comments
source code
 
do_css_CSSStyleDeclaration(self, style, separator=None)
Style declaration of CSSStyleRule
source code
 
do_Property(self, property)
Style declaration of CSSStyleRule
source code
 
do_Property_priority(self, priorityseq)
a Properties priority "!" S* "important"
source code
 
do_css_CSSValue(self, cssvalue)
serializes a CSSValue
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__notinurimatcher(...)

source code 
match(string[, pos[, endpos]]) --> match object or None. Matches zero or more characters at the beginning of the string

__init__(self, prefs=None)
(Constructor)

source code 
prefs
instance of Preferences
Overrides: object.__init__

_indentblock(self, text, level)

source code 
indent a block like a CSSStyleDeclaration to the given level which may be higher than self._level (e.g. for CSSStyleDeclaration)

do_stylesheets_medialist(self, medialist)

source code 

comma-separated list of media, default is 'all'

If "all" is in the list, every other media except "handheld" will be stripped. This is because how Opera handles CSS for PDAs.

do_CSSCharsetRule(self, rule)

source code 

serializes CSSCharsetRule encoding: string

always @charset "encoding"; no comments or other things allowed!

do_CSSFontFaceRule(self, rule)

source code 

serializes CSSFontFaceRule

style
CSSStyleDeclaration
  • CSSComments

do_CSSImportRule(self, rule)

source code 

serializes CSSImportRule

href
string
hreftype
'uri' or 'string'
media
cssutils.stylesheets.medialist.MediaList
  • CSSComments

do_CSSNamespaceRule(self, rule)

source code 

serializes CSSNamespaceRule

uri
string
prefix
string
  • CSSComments

do_CSSMediaRule(self, rule)

source code 

serializes CSSMediaRule

  • CSSComments

do_CSSPageRule(self, rule)

source code 

serializes CSSPageRule

selectorText
string
style
CSSStyleDeclaration
  • CSSComments

do_CSSStyleRule(self, rule)

source code 

serializes CSSStyleRule

selectorList style

  • CSSComments

do_css_Selector(self, selector)

source code 

a single selector including comments

TODO: style combinators like + >

do_Property(self, property)

source code 

Style declaration of CSSStyleRule

Property has a seqs attribute which contains seq lists for name, a CSSvalue and a seq list for priority