Change extend format to :extend(.class); - part 1 - support for stand-alone &:extend(.class);

This commit is contained in:
Luke Page
2012-11-05 21:01:41 +00:00
parent d9f929a063
commit c1efcf4e57
7 changed files with 34 additions and 37 deletions

View File

@@ -525,9 +525,8 @@ less.Parser = function Parser(env) {
primary: function () {
var node, root = [];
while ((node = $(this.mixin.definition) || $(this.rule) || $(this.ruleset) ||
$(this.mixin.call) || $(this.comment) || $(this.directive) ||
$(this.extend))
while ((node = $(this.extend) || $(this.mixin.definition) || $(this.rule) || $(this.ruleset) ||
$(this.mixin.call) || $(this.comment) || $(this.directive))
|| $(/^[\s\n]+/) || $(/^;+/)) {
node && root.push(node);
}
@@ -814,15 +813,15 @@ less.Parser = function Parser(env) {
extend: function() {
var elements = [], e, args, index = i;
if (input.charAt(i) !== '+') { return; }
if (!$(/^&:extend\(/)) { return; }
while (e = $(/^\+\+[#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/)) {
elements.push(new(tree.Element)(null, e.slice(2), i));
while (e = $(/^[#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/)) {
elements.push(new(tree.Element)(null, e, i));
}
expect(/^\);/);
if (elements.length > 0 && ($(';') || peek('}'))) {
return new(tree.Extend)(elements, index);
}
return new(tree.Extend)(elements, index);
},
//