Handle bootstrap mixin scope strangness
This commit is contained in:
parent
c02ef34604
commit
e149df85d6
@ -42,18 +42,18 @@ class Deferred(Node):
|
||||
ident.parse(None)
|
||||
mixins = scope.mixins(ident.raw())
|
||||
|
||||
|
||||
if not mixins:
|
||||
store = [t for t in scope.deferred.tokens]
|
||||
while scope.deferred.tokens:
|
||||
store = [t for t in scope.deferred.parsed[-1]]
|
||||
while scope.deferred.parsed[-1]:
|
||||
scope.current = scope.deferred
|
||||
ident.parse(scope)
|
||||
mixins = scope.mixins(ident.raw())
|
||||
scope.current = None
|
||||
if mixins:
|
||||
scope.deferred.tokens = store
|
||||
break
|
||||
scope.deferred.tokens.pop()
|
||||
scope.deferred.parse(None)
|
||||
scope.deferred.parsed[-1].pop()
|
||||
scope.deferred.parsed[-1] = store
|
||||
|
||||
if mixins:
|
||||
for mixin in mixins:
|
||||
@ -64,7 +64,7 @@ class Deferred(Node):
|
||||
res = [p.parse(scope) for p in res if p]
|
||||
while(any(t for t in res if type(t) is Deferred)):
|
||||
res = [p.parse(scope) for p in res if p]
|
||||
scope.deferred = None
|
||||
|
||||
if error and not res:
|
||||
raise SyntaxError('NameError `%s`' % mixin.raw(True))
|
||||
return res
|
||||
|
@ -72,7 +72,7 @@ class Identifier(Node):
|
||||
parent = parent[-1]
|
||||
if parent.parsed:
|
||||
return [self._pscn(part, n)
|
||||
if part[0] not in self._subp
|
||||
if part and part[0] not in self._subp
|
||||
else n
|
||||
for part in parent.parsed
|
||||
for n in names]
|
||||
|
@ -4,3 +4,42 @@ span {
|
||||
padding: 2px;
|
||||
padding: 1px;
|
||||
}
|
||||
input, textarea, .uneditable-input {
|
||||
margin-left: 0;
|
||||
}
|
||||
input.span12, textarea.span12, .uneditable-input.span12 {
|
||||
width: 354;
|
||||
}
|
||||
input.span11, textarea.span11, .uneditable-input.span11 {
|
||||
width: 322;
|
||||
}
|
||||
input.span10, textarea.span10, .uneditable-input.span10 {
|
||||
width: 290;
|
||||
}
|
||||
input.span9, textarea.span9, .uneditable-input.span9 {
|
||||
width: 258;
|
||||
}
|
||||
input.span8, textarea.span8, .uneditable-input.span8 {
|
||||
width: 226;
|
||||
}
|
||||
input.span7, textarea.span7, .uneditable-input.span7 {
|
||||
width: 194;
|
||||
}
|
||||
input.span6, textarea.span6, .uneditable-input.span6 {
|
||||
width: 162;
|
||||
}
|
||||
input.span5, textarea.span5, .uneditable-input.span5 {
|
||||
width: 130;
|
||||
}
|
||||
input.span4, textarea.span4, .uneditable-input.span4 {
|
||||
width: 98;
|
||||
}
|
||||
input.span3, textarea.span3, .uneditable-input.span3 {
|
||||
width: 66;
|
||||
}
|
||||
input.span2, textarea.span2, .uneditable-input.span2 {
|
||||
width: 34;
|
||||
}
|
||||
input.span1, textarea.span1, .uneditable-input.span1 {
|
||||
width: 2;
|
||||
}
|
13
lesscpy/test/css/mixin-args-local-calls.min.css
vendored
13
lesscpy/test/css/mixin-args-local-calls.min.css
vendored
@ -1 +1,14 @@
|
||||
span{padding:1px;padding:2px;padding:2px;padding:1px;}
|
||||
input,textarea,.uneditable-input{margin-left:0;}
|
||||
input.span12,textarea.span12,.uneditable-input.span12{width:354;}
|
||||
input.span11,textarea.span11,.uneditable-input.span11{width:322;}
|
||||
input.span10,textarea.span10,.uneditable-input.span10{width:290;}
|
||||
input.span9,textarea.span9,.uneditable-input.span9{width:258;}
|
||||
input.span8,textarea.span8,.uneditable-input.span8{width:226;}
|
||||
input.span7,textarea.span7,.uneditable-input.span7{width:194;}
|
||||
input.span6,textarea.span6,.uneditable-input.span6{width:162;}
|
||||
input.span5,textarea.span5,.uneditable-input.span5{width:130;}
|
||||
input.span4,textarea.span4,.uneditable-input.span4{width:98;}
|
||||
input.span3,textarea.span3,.uneditable-input.span3{width:66;}
|
||||
input.span2,textarea.span2,.uneditable-input.span2{width:34;}
|
||||
input.span1,textarea.span1,.uneditable-input.span1{width:2;}
|
||||
|
@ -18,4 +18,36 @@ span {
|
||||
.a .b(); // 2px
|
||||
.a .c(); // 2px
|
||||
.a .d(); // 1px
|
||||
}
|
||||
}
|
||||
/*
|
||||
Bootstrap style funkyness
|
||||
*/
|
||||
@gridColumnWidth: 20;
|
||||
@gridGutterWidth: 20;
|
||||
@gridColumns: 12;
|
||||
|
||||
#grid {
|
||||
.input(@gridColumnWidthx, @gridGutterWidthx) {
|
||||
|
||||
.spanX (@index) when (@index > 0) {
|
||||
(~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}") { .span(@index); }
|
||||
.spanX(@index - 1);
|
||||
}
|
||||
.spanX (0) {}
|
||||
|
||||
.span(@columns) {
|
||||
width: ((@gridColumnWidthx) * @columns) + (@gridGutterWidthx * (@columns - 1)) - 10;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea,
|
||||
.uneditable-input {
|
||||
margin-left: 0; // override margin-left from core grid system
|
||||
}
|
||||
|
||||
// generate .spanX
|
||||
.spanX (@gridColumns);
|
||||
|
||||
}
|
||||
}
|
||||
#grid > .input (12, 20);
|
Loading…
x
Reference in New Issue
Block a user