Update bundled cssutils

This commit is contained in:
Kovid Goyal 2010-02-07 11:10:36 -07:00
parent 262b844595
commit 6248c2105f
2 changed files with 29 additions and 20 deletions

View File

@ -88,11 +88,11 @@ Usage may be::
__all__ = ['css', 'stylesheets', 'CSSParser', 'CSSSerializer'] __all__ = ['css', 'stylesheets', 'CSSParser', 'CSSSerializer']
__docformat__ = 'restructuredtext' __docformat__ = 'restructuredtext'
__author__ = 'Christof Hoeke with contributions by Walter Doerwald' __author__ = 'Christof Hoeke with contributions by Walter Doerwald'
__date__ = '$LastChangedDate:: 2009-11-26 16:31:32 -0700 #$:' __date__ = '$LastChangedDate:: 2009-12-30 14:26:29 -0700 #$:'
VERSION = '0.9.7a1' VERSION = '0.9.7a2'
__version__ = '%s $Id: __init__.py 1892 2009-11-26 23:31:32Z cthedot $' % VERSION __version__ = '%s $Id: __init__.py 1902 2009-12-30 21:26:29Z cthedot $' % VERSION
import codec import codec
import os.path import os.path

View File

@ -8,7 +8,7 @@
__all__ = ['CSSValue', 'CSSPrimitiveValue', 'CSSValueList', __all__ = ['CSSValue', 'CSSPrimitiveValue', 'CSSValueList',
'CSSVariable', 'RGBColor'] 'CSSVariable', 'RGBColor']
__docformat__ = 'restructuredtext' __docformat__ = 'restructuredtext'
__version__ = '$Id: cssvalue.py 1864 2009-10-11 15:11:39Z cthedot $' __version__ = '$Id: cssvalue.py 1909 2010-01-04 19:28:52Z cthedot $'
from cssutils.prodparser import * from cssutils.prodparser import *
import cssutils import cssutils
@ -861,25 +861,34 @@ class CSSFunction(CSSPrimitiveValue):
def _productiondefinition(self): def _productiondefinition(self):
"""Return defintion used for parsing.""" """Return defintion used for parsing."""
types = self._prods # rename! types = self._prods # rename!
valueProd = Prod(name='PrimitiveValue', valueOrFunc = Choice(Prod(name='PrimitiveValue',
match=lambda t, v: t in (types.DIMENSION, match=lambda t, v: t in (types.DIMENSION,
types.IDENT, types.IDENT,
types.NUMBER, types.NUMBER,
types.PERCENTAGE, types.PERCENTAGE,
types.STRING), types.STRING),
toSeq=lambda t, tokens: (t[0], CSSPrimitiveValue(t[1]))) toSeq=lambda t, tokens: (t[0], CSSPrimitiveValue(t[1]))
),
# FUNC is actually not in spec but used in e.g. Prince
PreDef.function(toSeq=lambda t,
tokens: ('FUNCTION',
CSSFunction(
cssutils.helper.pushtoken(t, tokens))
)
)
)
funcProds = Sequence(Prod(name='FUNC', funcProds = Sequence(Prod(name='FUNC',
match=lambda t, v: t == types.FUNCTION, match=lambda t, v: t == types.FUNCTION,
toSeq=lambda t, tokens: (t[0], cssutils.helper.normalize(t[1]))), toSeq=lambda t, tokens: (t[0], cssutils.helper.normalize(t[1]))),
Choice(Sequence(PreDef.unary(), Choice(Sequence(PreDef.unary(),
valueProd, valueOrFunc,
# more values starting with Comma # more values starting with Comma
# should use store where colorType is saved to # should use store where colorType is saved to
# define min and may, closure? # define min and may, closure?
Sequence(PreDef.comma(), Sequence(PreDef.comma(),
PreDef.unary(), PreDef.unary(),
valueProd, valueOrFunc,
minmax=lambda: (0, 3)), minmax=lambda: (0, 3)),
PreDef.funcEnd(stop=True)), PreDef.funcEnd(stop=True)),
PreDef.funcEnd(stop=True)) PreDef.funcEnd(stop=True))