Skip to content

Commit

Permalink
fix(issue:4211) parse entities for comma list
Browse files Browse the repository at this point in the history
parse the correct entities for a comma separated list so that all URLs are
rewritten correctly.
  • Loading branch information
puckowski committed Aug 20, 2023
1 parent 6390ae3 commit 7d31d1c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 8 deletions.
9 changes: 8 additions & 1 deletion dist/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -4706,6 +4706,10 @@
if (e) {
value.push(e);
}
if (parserInput.peek(',')) {
value.push(new (tree.Anonymous)(',', parserInput.i));
parserInput.$char(',');
}
} while (e);
done = testCurrentChar();
if (value.length > 0) {
Expand Down Expand Up @@ -7125,7 +7129,10 @@
for (var i_1 = 0; i_1 < this.value.length; i_1++) {
this.value[i_1].genCSS(context, output);
if (!this.noSpacing && i_1 + 1 < this.value.length) {
output.add(' ');
if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) ||
this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') {
output.add(' ');
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion dist/less.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/less.min.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion packages/less/dist/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -4706,6 +4706,10 @@
if (e) {
value.push(e);
}
if (parserInput.peek(',')) {
value.push(new (tree.Anonymous)(',', parserInput.i));
parserInput.$char(',');
}
} while (e);
done = testCurrentChar();
if (value.length > 0) {
Expand Down Expand Up @@ -7125,7 +7129,10 @@
for (var i_1 = 0; i_1 < this.value.length; i_1++) {
this.value[i_1].genCSS(context, output);
if (!this.noSpacing && i_1 + 1 < this.value.length) {
output.add(' ');
if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) ||
this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') {
output.add(' ');
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/less/dist/less.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/less/dist/less.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/less/src/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,10 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
if (e) {
value.push(e);
}
if (parserInput.peek(',')) {
value.push(new (tree.Anonymous)(',', parserInput.i));
parserInput.$char(',');
}
} while (e);

done = testCurrentChar();
Expand Down
8 changes: 6 additions & 2 deletions packages/less/src/less/tree/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Node from './node';
import Paren from './paren';
import Comment from './comment';
import Dimension from './dimension';
import Anonymous from './anonymous';

const Expression = function(value, noSpacing) {
this.value = value;
Expand Down Expand Up @@ -45,7 +46,7 @@ Expression.prototype = Object.assign(new Node(), {
if (inParenthesis) {
context.outOfParenthesis();
}
if (this.parens && this.parensInOp && !mathOn && !doubleParen
if (this.parens && this.parensInOp && !mathOn && !doubleParen
&& (!(returnValue instanceof Dimension))) {
returnValue = new Paren(returnValue);
}
Expand All @@ -56,7 +57,10 @@ Expression.prototype = Object.assign(new Node(), {
for (let i = 0; i < this.value.length; i++) {
this.value[i].genCSS(context, output);
if (!this.noSpacing && i + 1 < this.value.length) {
output.add(' ');
if (i + 1 < this.value.length && !(this.value[i + 1] instanceof Anonymous) ||
this.value[i + 1] instanceof Anonymous && this.value[i + 1].value !== ',') {
output.add(' ');
}
}
}
},
Expand Down

0 comments on commit 7d31d1c

Please sign in to comment.