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
|
|
@ -1,6 +1,6 @@
|
|||
# This software is OSI Certified Open Source Software.
|
||||
# OSI Certified is a certification mark of the Open Source Initiative.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2006, Enthought, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ class SVGTransformationParser(object):
|
|||
commands = []
|
||||
token = next()
|
||||
while token[0] is not EOF:
|
||||
command, token = self.rule_svg_transform(next, token)
|
||||
commands.append(command)
|
||||
command, token = self.rule_svg_transform(next, token)
|
||||
commands.append(command)
|
||||
return commands
|
||||
|
||||
def rule_svg_transform(self, next, token):
|
||||
|
|
@ -177,7 +177,7 @@ class SVGTransformationParser(object):
|
|||
number, token = self.rule_optional_number(next, token)
|
||||
if number is not None:
|
||||
numbers.append(number)
|
||||
|
||||
|
||||
return numbers, token
|
||||
|
||||
def rule_1number(self, next, token):
|
||||
|
|
@ -199,10 +199,10 @@ class SVGTransformationParser(object):
|
|||
# but, if the 2nd number is provided, the 3rd is mandatory.
|
||||
# we can't have just 2.
|
||||
numbers.append(number)
|
||||
|
||||
|
||||
number, token = self.rule_number(next, token)
|
||||
numbers.append(number)
|
||||
|
||||
|
||||
return numbers, token
|
||||
|
||||
def rule_6numbers(self, next, token):
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
# scour needed a bare-minimum CSS parser in order to determine if some elements
|
||||
# were still referenced by CSS properties.
|
||||
|
||||
# I looked at css-py (a CSS parser built in Python), but that library
|
||||
# is about 35k of Python and requires ply to be installed. I just need
|
||||
# I looked at css-py (a CSS parser built in Python), but that library
|
||||
# is about 35k of Python and requires ply to be installed. I just need
|
||||
# something very basic to suit scour's needs.
|
||||
|
||||
# yocto-css takes a string of CSS and tries to spit out a list of rules
|
||||
|
|
@ -45,28 +45,28 @@
|
|||
# value : [ any | block | ATKEYWORD S* ]+;
|
||||
# any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING
|
||||
# | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES
|
||||
# | DASHMATCH | FUNCTION S* any* ')'
|
||||
# | DASHMATCH | FUNCTION S* any* ')'
|
||||
# | '(' S* any* ')' | '[' S* any* ']' ] S*;
|
||||
|
||||
def parseCssString(str):
|
||||
rules = []
|
||||
# first, split on } to get the rule chunks
|
||||
chunks = str.split('}')
|
||||
for chunk in chunks:
|
||||
# second, split on { to get the selector and the list of properties
|
||||
bits = chunk.split('{')
|
||||
if len(bits) != 2: continue
|
||||
rule = {}
|
||||
rule['selector'] = bits[0].strip()
|
||||
# third, split on ; to get the property declarations
|
||||
bites = bits[1].strip().split(';')
|
||||
if len(bites) < 1: continue
|
||||
props = {}
|
||||
for bite in bites:
|
||||
# fourth, split on : to get the property name and value
|
||||
nibbles = bite.strip().split(':')
|
||||
if len(nibbles) != 2: continue
|
||||
props[nibbles[0].strip()] = nibbles[1].strip()
|
||||
rule['properties'] = props
|
||||
rules.append(rule)
|
||||
return rules
|
||||
rules = []
|
||||
# first, split on } to get the rule chunks
|
||||
chunks = str.split('}')
|
||||
for chunk in chunks:
|
||||
# second, split on { to get the selector and the list of properties
|
||||
bits = chunk.split('{')
|
||||
if len(bits) != 2: continue
|
||||
rule = {}
|
||||
rule['selector'] = bits[0].strip()
|
||||
# third, split on ; to get the property declarations
|
||||
bites = bits[1].strip().split(';')
|
||||
if len(bites) < 1: continue
|
||||
props = {}
|
||||
for bite in bites:
|
||||
# fourth, split on : to get the property name and value
|
||||
nibbles = bite.strip().split(':')
|
||||
if len(nibbles) != 2: continue
|
||||
props[nibbles[0].strip()] = nibbles[1].strip()
|
||||
rule['properties'] = props
|
||||
rules.append(rule)
|
||||
return rules
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -20,7 +20,7 @@ from setuptools import setup, find_packages
|
|||
|
||||
setup (
|
||||
name = 'scour',
|
||||
version = '0.26',
|
||||
version = '0.27',
|
||||
description = 'Scour SVG Optimizer',
|
||||
long_description = open("README.md").read(),
|
||||
license = 'Apache License 2.0',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue