Skip to content

Commit

Permalink
Add a new preference to indent the ending semicolen, the semicolen is…
Browse files Browse the repository at this point in the history
… indented by default which is the current behavior.
  • Loading branch information
kgn committed Apr 22, 2011
1 parent 06871cc commit 248bf35
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cssutils/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Preferences(object):
format ``url(URI)`` if ``'uri'``
indent = 4 * ' '
Indentation of e.g Properties inside a CSSStyleDeclaration
indentEndingSemicolon = True
Indentation the last semicolon to match the indentation level of the block
indentSpecificities = False
Indent rules with subset of Selectors and higher Specitivity
Expand Down Expand Up @@ -124,6 +126,7 @@ def useDefaults(self):
self.importHrefFormat = None
self.indent = 4 * u' '
self.indentSpecificities = False
self.indentEndingSemicolon = True
self.keepAllProperties = True
self.keepComments = True
self.keepEmptyRules = False
Expand Down Expand Up @@ -564,7 +567,7 @@ def do_CSSMediaRule(self, rule):
out.extend(rulesout)

# }
out.append(u'%s}' % ((self._level + 1) * self.prefs.indent))
out.append(u'%s}' % ((self._level + int(self.prefs.indentEndingSemicolon)) * self.prefs.indent))

return u''.join(out)

Expand Down Expand Up @@ -694,7 +697,7 @@ def do_CSSStyleRule(self, rule):
self.prefs.lineSeparator,
self._indentblock(styleText, self._level + 1),
self.prefs.lineSeparator,
(self._level + 1) * self.prefs.indent),
(self._level + int(self.prefs.indentEndingSemicolon)) * self.prefs.indent),
self._selectorlevel)

def do_css_SelectorList(self, selectorlist):
Expand Down

0 comments on commit 248bf35

Please sign in to comment.