summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-29 21:09:53 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-09-01 21:30:57 -0700
commited27be468c3104620d5a880e7aee8b4deb4ca5f4 (patch)
treeb02e29fb25d71d3334f44b95f8a2c7e0a8f1c72f
parent3e73cf11f11a69731fc14ace34c7e99614964698 (diff)
downloadpyscss-ed27be468c3104620d5a880e7aee8b4deb4ca5f4.tar.gz
Use shiny new interpolation support on property names.
-rw-r--r--scss/blockast.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/scss/blockast.py b/scss/blockast.py
index f7ae857..812f98c 100644
--- a/scss/blockast.py
+++ b/scss/blockast.py
@@ -44,7 +44,7 @@ class Assignment(Declaration):
@classmethod
def parse(cls, name, value):
# TODO pull off !default, !global
- # TODO interp-parse the name
+ # TODO interp-parse the name? is that a thing?
# TODO this is a bit naughty, but uses no state except the ast_cache --
# which should maybe be in the Compiler anyway...?
@@ -58,25 +58,24 @@ class Assignment(Declaration):
class CSSDeclaration(Declaration):
- def __init__(self, prop, value_expression):
- self.prop = prop
+ def __init__(self, prop_expression, value_expression):
+ self.prop_expression = prop_expression
self.value_expression = value_expression
@classmethod
def parse(cls, prop, value):
- # TODO prop needs parsing too, but interp-only!
-
# TODO this is a bit naughty, but uses no state except the ast_cache --
# which should maybe be in the Compiler anyway...?
+ prop_expression = Calculator().parse_interpolations(prop)
value_expression = Calculator().parse_expression(value)
- return cls(prop, value_expression)
+ return cls(prop_expression, value_expression)
def evaluate(self, compilation):
- prop = self.prop
+ prop = self.prop_expression.evaluate(compilation.current_calculator)
value = self.value_expression.evaluate(compilation.current_calculator)
# TODO this is where source maps would need to get their info
- compilation.add_declaration(prop, value)
+ compilation.add_declaration(prop.value, value)
class _AtRuleMixin(object):