nested mixing-args
This commit is contained in:
parent
84379359f5
commit
db72420ca0
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
|
1
lesscpy/test/css/elements.min.css
vendored
1
lesscpy/test/css/elements.min.css
vendored
@ -1 +0,0 @@
|
||||
|
59
lesscpy/test/css/mixin-args-nested.css
Normal file
59
lesscpy/test/css/mixin-args-nested.css
Normal 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;
|
||||
}
|
19
lesscpy/test/css/mixin-args-nested.min.css
vendored
Normal file
19
lesscpy/test/css/mixin-args-nested.min.css
vendored
Normal 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;}
|
@ -56,3 +56,9 @@
|
||||
.arguments4 {
|
||||
border: 1px solid red;
|
||||
}
|
||||
.div :-moz-placeholder {
|
||||
color: #ffffff;
|
||||
}
|
||||
.div :-moz-placeholder::-webkit-input-placeholder {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
2
lesscpy/test/css/mixin-args.min.css
vendored
2
lesscpy/test/css/mixin-args.min.css
vendored
@ -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;}
|
||||
|
@ -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;
|
||||
}
|
||||
|
1
lesscpy/test/css/mixin-blocks.min.css
vendored
1
lesscpy/test/css/mixin-blocks.min.css
vendored
@ -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;}
|
||||
|
68
lesscpy/test/less/mixin-args-nested.less
Normal file
68
lesscpy/test/less/mixin-args-nested.less
Normal 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);
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user