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

Class Preferences

source code

object --+
         |
        Preferences

controls output of CSSSerializer

defaultAtKeyword = True
Should the literal @keyword from src CSS be used or the default form, e.g. if True: @import else: @i\mport
defaultPropertyName = True

Should the normalized propertyname be used or the one given in the src file, e.g. if True: color else: c\olor

Only used if keepAllProperties==False.

defaultPropertyPriority = True
Should the normalized or literal priority be used, e.g. '!important' or u'!Important'
importHrefFormat = None
Uses hreftype if None or explicit 'string' or 'uri'
indent = 4 * ' '
Indentation of e.g Properties inside a CSSStyleDeclaration
indentSpecificities = False
Indent rules with subset of Selectors and higher Specitivity
keepAllProperties = True
If True all properties set in the original CSSStylesheet are kept meaning even properties set twice with the exact same same name are kept!
keepComments = True
If False removes all CSSComments
keepEmptyRules = False
defines if empty rules like e.g. a {} are kept in the resulting serialized sheet
keepUsedNamespaceRulesOnly = False
if True only namespace rules which are actually used are kept
lineNumbers = False
Only used if a complete CSSStyleSheet is serialized.
lineSeparator = u'n'
How to end a line. This may be set to e.g. u'' for serializing of CSSStyleDeclarations usable in HTML style attribute.
listItemSpacer = u' '
string which is used in css.SelectorList, css.CSSValue and stylesheets.MediaList after the comma
omitLastSemicolon = True
If True omits ; after last property of CSSStyleDeclaration
paranthesisSpacer = u' '
string which is used before an opening paranthesis like in a css.CSSMediaRule or css.CSSStyleRule
propertyNameSpacer = u' '
string which is used after a Property name colon
selectorCombinatorSpacer = u' '
string which is used before and after a Selector combinator like +, > or ~. CSSOM defines a single space for this which is also the default in cssutils.
spacer = u' '
general spacer, used e.g. by CSSUnknownRule
validOnly = False DO NOT CHANGE YET

if True only valid (currently Properties) are kept

A Property is valid if it is a known Property with a valid value. Currently CSS 2.1 values as defined in cssproperties.py would be valid.

Instance Methods [hide private]
 
__init__(self, **initials)
Always use named instead of positional parameters
source code
 
useDefaults(self)
reset all preference options to the default value
source code
 
useMinified(self)
sets options to achive a minified stylesheet
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **initials)
(Constructor)

source code 
Always use named instead of positional parameters
Overrides: object.__init__

useMinified(self)

source code 

sets options to achive a minified stylesheet

you may want to set preferences with this convenience method and set settings you want adjusted afterwards

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)