Skip to content

Commit 7d31d1c

Browse files
committed
fix(issue:4211) parse entities for comma list
parse the correct entities for a comma separated list so that all URLs are rewritten correctly.
1 parent 6390ae3 commit 7d31d1c

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

dist/less.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4706,6 +4706,10 @@
47064706
if (e) {
47074707
value.push(e);
47084708
}
4709+
if (parserInput.peek(',')) {
4710+
value.push(new (tree.Anonymous)(',', parserInput.i));
4711+
parserInput.$char(',');
4712+
}
47094713
} while (e);
47104714
done = testCurrentChar();
47114715
if (value.length > 0) {
@@ -7125,7 +7129,10 @@
71257129
for (var i_1 = 0; i_1 < this.value.length; i_1++) {
71267130
this.value[i_1].genCSS(context, output);
71277131
if (!this.noSpacing && i_1 + 1 < this.value.length) {
7128-
output.add(' ');
7132+
if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) ||
7133+
this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') {
7134+
output.add(' ');
7135+
}
71297136
}
71307137
}
71317138
},

dist/less.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/less.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/less/dist/less.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4706,6 +4706,10 @@
47064706
if (e) {
47074707
value.push(e);
47084708
}
4709+
if (parserInput.peek(',')) {
4710+
value.push(new (tree.Anonymous)(',', parserInput.i));
4711+
parserInput.$char(',');
4712+
}
47094713
} while (e);
47104714
done = testCurrentChar();
47114715
if (value.length > 0) {
@@ -7125,7 +7129,10 @@
71257129
for (var i_1 = 0; i_1 < this.value.length; i_1++) {
71267130
this.value[i_1].genCSS(context, output);
71277131
if (!this.noSpacing && i_1 + 1 < this.value.length) {
7128-
output.add(' ');
7132+
if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) ||
7133+
this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') {
7134+
output.add(' ');
7135+
}
71297136
}
71307137
}
71317138
},

packages/less/dist/less.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/less/dist/less.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/less/src/less/parser/parser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,10 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
16251625
if (e) {
16261626
value.push(e);
16271627
}
1628+
if (parserInput.peek(',')) {
1629+
value.push(new (tree.Anonymous)(',', parserInput.i));
1630+
parserInput.$char(',');
1631+
}
16281632
} while (e);
16291633

16301634
done = testCurrentChar();

packages/less/src/less/tree/expression.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Node from './node';
22
import Paren from './paren';
33
import Comment from './comment';
44
import Dimension from './dimension';
5+
import Anonymous from './anonymous';
56

67
const Expression = function(value, noSpacing) {
78
this.value = value;
@@ -45,7 +46,7 @@ Expression.prototype = Object.assign(new Node(), {
4546
if (inParenthesis) {
4647
context.outOfParenthesis();
4748
}
48-
if (this.parens && this.parensInOp && !mathOn && !doubleParen
49+
if (this.parens && this.parensInOp && !mathOn && !doubleParen
4950
&& (!(returnValue instanceof Dimension))) {
5051
returnValue = new Paren(returnValue);
5152
}
@@ -56,7 +57,10 @@ Expression.prototype = Object.assign(new Node(), {
5657
for (let i = 0; i < this.value.length; i++) {
5758
this.value[i].genCSS(context, output);
5859
if (!this.noSpacing && i + 1 < this.value.length) {
59-
output.add(' ');
60+
if (i + 1 < this.value.length && !(this.value[i + 1] instanceof Anonymous) ||
61+
this.value[i + 1] instanceof Anonymous && this.value[i + 1].value !== ',') {
62+
output.add(' ');
63+
}
6064
}
6165
}
6266
},

0 commit comments

Comments
 (0)