whitespace cleanup
This commit is contained in:
parent
0e35c9d40f
commit
8dc6137373
5 changed files with 2696 additions and 2694 deletions
5328
scour/scour.py
5328
scour/scour.py
File diff suppressed because it is too large
Load diff
|
|
@ -149,8 +149,8 @@ class SVGTransformationParser(object):
|
||||||
commands = []
|
commands = []
|
||||||
token = next()
|
token = next()
|
||||||
while token[0] is not EOF:
|
while token[0] is not EOF:
|
||||||
command, token = self.rule_svg_transform(next, token)
|
command, token = self.rule_svg_transform(next, token)
|
||||||
commands.append(command)
|
commands.append(command)
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
def rule_svg_transform(self, next, token):
|
def rule_svg_transform(self, next, token):
|
||||||
|
|
|
||||||
|
|
@ -49,24 +49,24 @@
|
||||||
# | '(' S* any* ')' | '[' S* any* ']' ] S*;
|
# | '(' S* any* ')' | '[' S* any* ']' ] S*;
|
||||||
|
|
||||||
def parseCssString(str):
|
def parseCssString(str):
|
||||||
rules = []
|
rules = []
|
||||||
# first, split on } to get the rule chunks
|
# first, split on } to get the rule chunks
|
||||||
chunks = str.split('}')
|
chunks = str.split('}')
|
||||||
for chunk in chunks:
|
for chunk in chunks:
|
||||||
# second, split on { to get the selector and the list of properties
|
# second, split on { to get the selector and the list of properties
|
||||||
bits = chunk.split('{')
|
bits = chunk.split('{')
|
||||||
if len(bits) != 2: continue
|
if len(bits) != 2: continue
|
||||||
rule = {}
|
rule = {}
|
||||||
rule['selector'] = bits[0].strip()
|
rule['selector'] = bits[0].strip()
|
||||||
# third, split on ; to get the property declarations
|
# third, split on ; to get the property declarations
|
||||||
bites = bits[1].strip().split(';')
|
bites = bits[1].strip().split(';')
|
||||||
if len(bites) < 1: continue
|
if len(bites) < 1: continue
|
||||||
props = {}
|
props = {}
|
||||||
for bite in bites:
|
for bite in bites:
|
||||||
# fourth, split on : to get the property name and value
|
# fourth, split on : to get the property name and value
|
||||||
nibbles = bite.strip().split(':')
|
nibbles = bite.strip().split(':')
|
||||||
if len(nibbles) != 2: continue
|
if len(nibbles) != 2: continue
|
||||||
props[nibbles[0].strip()] = nibbles[1].strip()
|
props[nibbles[0].strip()] = nibbles[1].strip()
|
||||||
rule['properties'] = props
|
rule['properties'] = props
|
||||||
rules.append(rule)
|
rules.append(rule)
|
||||||
return rules
|
return rules
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -20,7 +20,7 @@ from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup (
|
setup (
|
||||||
name = 'scour',
|
name = 'scour',
|
||||||
version = '0.26',
|
version = '0.27',
|
||||||
description = 'Scour SVG Optimizer',
|
description = 'Scour SVG Optimizer',
|
||||||
long_description = open("README.md").read(),
|
long_description = open("README.md").read(),
|
||||||
license = 'Apache License 2.0',
|
license = 'Apache License 2.0',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue