nested mixing-args

This commit is contained in:
jtm 2012-03-18 10:30:25 +00:00
parent 84379359f5
commit db72420ca0
11 changed files with 166 additions and 4 deletions

View File

@ -28,14 +28,16 @@ class Mixin(Node):
args = args if type(args) is list else [args]
vars = []
for arg, var in itertools.zip_longest([a for a in args if a != ','], parsed):
if arg is None and utility.is_variable(var):
raise SyntaxError('Missing argument to mixin')
if arg == var and utility.is_variable(arg):
continue
elif type(var) is Variable:
if arg: var.value = arg
elif utility.is_variable(arg):
tmp = scope.variables(arg)
if not tmp: continue
var = Variable([var, None, tmp.name]).parse(scope)
elif type(var) is Variable:
if arg: var.value = arg
elif utility.is_variable(var):
var = Variable([var, None, arg]).parse(scope)
else: continue

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -0,0 +1,59 @@
#e {
radius: 5px;
}
#j {
radius: 5px;
}
#k {
radius: 1px;
}
.content {
width: 600px;
}
.content .column {
margin: 600px;
}
.content .column.blue {
color: blue;
}
.content .column.blue .deep {
padding: 600px;
}
.content-em {
width: 200px;
}
.content-em .column {
margin: 200px;
}
.content-em .column.blue {
color: blue;
}
.content-em .column.blue .deep {
padding: 200px;
}
.test-2 {
width: 300px;
width: 300px;
}
.test-2 .column {
margin: 300px;
}
.test-2 .column.blue {
color: blue;
}
.test-2 .column.blue .deep {
padding: 300px;
}
.test-2-em {
width: 600px;
width: 600px;
}
.test-2-em .column {
margin: 600px;
}
.test-2-em .column.blue {
color: blue;
}
.test-2-em .column.blue .deep {
padding: 600px;
}

View File

@ -0,0 +1,19 @@
#e{radius:5px;}
#j{radius:5px;}
#k{radius:1px;}
.content{width:600px;}
.content .column{margin:600px;}
.content .column.blue{color:blue;}
.content .column.blue .deep{padding:600px;}
.content-em{width:200px;}
.content-em .column{margin:200px;}
.content-em .column.blue{color:blue;}
.content-em .column.blue .deep{padding:200px;}
.test-2{width:300px;width:300px;}
.test-2 .column{margin:300px;}
.test-2 .column.blue{color:blue;}
.test-2 .column.blue .deep{padding:300px;}
.test-2-em{width:600px;width:600px;}
.test-2-em .column{margin:600px;}
.test-2-em .column.blue{color:blue;}
.test-2-em .column.blue .deep{padding:600px;}

View File

@ -56,3 +56,9 @@
.arguments4 {
border: 1px solid red;
}
.div :-moz-placeholder {
color: #ffffff;
}
.div :-moz-placeholder::-webkit-input-placeholder {
color: #ffffff;
}

View File

@ -14,3 +14,5 @@
.arguments3{border:0px;}
.arguments3{border:1px solid red;}
.arguments4{border:1px solid red;}
.div :-moz-placeholder{color:#ffffff;}
.div :-moz-placeholder::-webkit-input-placeholder{color:#ffffff;}

View File

@ -76,3 +76,6 @@ div.nest a:hover .deep p, div.nest a:focus .deep p {
border-color: orange;
background-color: grey;
}
.secure-zone {
color: transparent;
}

View File

@ -22,3 +22,4 @@ div.nest a:hover .deep p,div.nest a:focus .deep p{widows:3;}
#header #cookie{border-style:dashed;}
#header #cookie .chips{border-style:dotted;}
#header #cookie .chips .calories{color:black;border-color:orange;background-color:grey;}
.secure-zone{color:transparent;}

View File

@ -0,0 +1,68 @@
/*
Args nested
*/
.a(@radius) {
radius: @radius;
}
.b(@radius) {
.a(@radius);
}
.c(@radius) {
.b(@radius);
}
.d(@radius) {
.c(@radius);
}
#e {
.d(5px);
}
// kwarg
.f(@radius: 1px) {
radius: @radius;
}
.g(@radius) {
.f(@radius);
}
.h(@radius) {
.g(@radius);
}
.i(@radius: 1px) {
.h(@radius);
}
#j {
.i(5px);
}
#k {
.i();
}
//
// Nested
//
.nested-ruleset (@width: 200px) {
width: @width;
.column {
margin: @width;
&.blue {
color: blue;
.deep {
padding: @width;
}
}
}
}
.content {
.nested-ruleset(600px);
}
.content-em {
.nested-ruleset();
}
.nested-2(@width: 300px) {
width: @width;
.nested-ruleset(@width);
}
.test-2 {
.nested-2();
}
.test-2-em {
.nested-2(600px);
}

View File

@ -27,6 +27,8 @@ def create_test (args):
if not line: continue
self.assertEqual(line, pout[i], '%s: Line %d' % (cssf, i+1))
i += 1
if len(pout) > i and i:
self.fail("%s: result has more lines (%d < %d)" % (cssf, i, len(pout)))
else:
self.fail("%s not found..." % cssf)
if os.path.exists(minf):
@ -39,6 +41,8 @@ def create_test (args):
for line in cssf.readlines():
self.assertEqual(line.rstrip(), mout[i], '%s: Line %d' % (minf, i+1))
i += 1
if len(mout) > i and i:
self.fail("%s: result has more lines (%d < %d)" % (minf, i, len(mout)))
else:
self.fail("%s not found..." % minf)
return do_test_expected