mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Syntax changed to !merge(space | comma)
* Syntax changed to !merge(space | comma) * !merge(space) implemented by Expression instead of Value. * Added test for lonely property with !merge directive
This commit is contained in:
@@ -1501,12 +1501,13 @@ less.Parser = function Parser(env) {
|
||||
var separator;
|
||||
if (input.charAt(i) === '!') {
|
||||
if ($(/^! *merge\(/)) {
|
||||
if (input.charAt(i) === ")") {
|
||||
separator = " ";
|
||||
} else {
|
||||
separator = $(/[^)]/);
|
||||
}
|
||||
expect(")");
|
||||
separator = expect(/^ *space|comma */);
|
||||
if (separator) {
|
||||
separator = (separator.trim() === 'space')
|
||||
? ' '
|
||||
: ',';
|
||||
}
|
||||
expect(')');
|
||||
}
|
||||
}
|
||||
return separator;
|
||||
|
||||
@@ -485,9 +485,11 @@ tree.Ruleset.prototype = {
|
||||
parts = groups[k];
|
||||
|
||||
if (parts.length > 1) {
|
||||
parts[0].value = new (tree.Value)(parts.map(function (p) {
|
||||
return p.value;
|
||||
}), rule.merge);
|
||||
rule = parts[0];
|
||||
|
||||
rule.value = new ((rule.merge === ' ') ? tree.Expression : tree.Value)(parts.map(function (p) {
|
||||
return p.value;
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
(function (tree) {
|
||||
|
||||
tree.Value = function (value, separator) {
|
||||
tree.Value = function (value) {
|
||||
this.value = value;
|
||||
this.separator = separator ? separator : ",";
|
||||
};
|
||||
tree.Value.prototype = {
|
||||
type: "Value",
|
||||
@@ -21,7 +20,7 @@ tree.Value.prototype = {
|
||||
toCSS: function (env) {
|
||||
return this.value.map(function (e) {
|
||||
return e.toCSS(env);
|
||||
}).join(this.separator + ((env.compress || this.separator === " ") ? "" : " "));
|
||||
}).join(env.compress ? ',' : ', ');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user