htmljs-parser 5.4.2 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +24 -8
- package/dist/index.mjs +24 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1378,12 +1378,14 @@ var CONCISE_HTML_CONTENT = {
|
|
|
1378
1378
|
parentTag = this.activeTag;
|
|
1379
1379
|
}
|
|
1380
1380
|
if (!parentTag && curIndent) {
|
|
1381
|
-
|
|
1382
|
-
this.
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1381
|
+
if (code !== 47 /* FORWARD_SLASH */) {
|
|
1382
|
+
this.emitError(
|
|
1383
|
+
this.pos,
|
|
1384
|
+
7 /* INVALID_INDENTATION */,
|
|
1385
|
+
"Line has extra indentation at the beginning"
|
|
1386
|
+
);
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1387
1389
|
}
|
|
1388
1390
|
if (parentTag) {
|
|
1389
1391
|
if (parentTag.type === 1 /* text */ && code !== 45 /* HTML_BLOCK_DELIMITER */) {
|
|
@@ -1624,8 +1626,21 @@ var EXPRESSION = {
|
|
|
1624
1626
|
return;
|
|
1625
1627
|
}
|
|
1626
1628
|
if (expression.shouldTerminate(code, this.data, this.pos)) {
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
+
let wasExpression = false;
|
|
1630
|
+
if (expression.operators) {
|
|
1631
|
+
const prevNonWhitespacePos = lookBehindWhile(
|
|
1632
|
+
isWhitespaceCode,
|
|
1633
|
+
this.data,
|
|
1634
|
+
this.pos - 1
|
|
1635
|
+
);
|
|
1636
|
+
if (prevNonWhitespacePos > expression.start) {
|
|
1637
|
+
wasExpression = lookBehindForOperator(this.data, prevNonWhitespacePos) !== -1;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
if (!wasExpression) {
|
|
1641
|
+
this.exitState();
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1629
1644
|
}
|
|
1630
1645
|
}
|
|
1631
1646
|
switch (code) {
|
|
@@ -2646,6 +2661,7 @@ var PARSED_STRING = {
|
|
|
2646
2661
|
},
|
|
2647
2662
|
char(code, str) {
|
|
2648
2663
|
if (code === str.quoteCharCode) {
|
|
2664
|
+
this.startText();
|
|
2649
2665
|
this.pos++;
|
|
2650
2666
|
this.exitState();
|
|
2651
2667
|
} else if (!states_exports.checkForPlaceholder(this, code)) {
|
package/dist/index.mjs
CHANGED
|
@@ -1353,12 +1353,14 @@ var CONCISE_HTML_CONTENT = {
|
|
|
1353
1353
|
parentTag = this.activeTag;
|
|
1354
1354
|
}
|
|
1355
1355
|
if (!parentTag && curIndent) {
|
|
1356
|
-
|
|
1357
|
-
this.
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1356
|
+
if (code !== 47 /* FORWARD_SLASH */) {
|
|
1357
|
+
this.emitError(
|
|
1358
|
+
this.pos,
|
|
1359
|
+
7 /* INVALID_INDENTATION */,
|
|
1360
|
+
"Line has extra indentation at the beginning"
|
|
1361
|
+
);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1362
1364
|
}
|
|
1363
1365
|
if (parentTag) {
|
|
1364
1366
|
if (parentTag.type === 1 /* text */ && code !== 45 /* HTML_BLOCK_DELIMITER */) {
|
|
@@ -1599,8 +1601,21 @@ var EXPRESSION = {
|
|
|
1599
1601
|
return;
|
|
1600
1602
|
}
|
|
1601
1603
|
if (expression.shouldTerminate(code, this.data, this.pos)) {
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
+
let wasExpression = false;
|
|
1605
|
+
if (expression.operators) {
|
|
1606
|
+
const prevNonWhitespacePos = lookBehindWhile(
|
|
1607
|
+
isWhitespaceCode,
|
|
1608
|
+
this.data,
|
|
1609
|
+
this.pos - 1
|
|
1610
|
+
);
|
|
1611
|
+
if (prevNonWhitespacePos > expression.start) {
|
|
1612
|
+
wasExpression = lookBehindForOperator(this.data, prevNonWhitespacePos) !== -1;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
if (!wasExpression) {
|
|
1616
|
+
this.exitState();
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1604
1619
|
}
|
|
1605
1620
|
}
|
|
1606
1621
|
switch (code) {
|
|
@@ -2621,6 +2636,7 @@ var PARSED_STRING = {
|
|
|
2621
2636
|
},
|
|
2622
2637
|
char(code, str) {
|
|
2623
2638
|
if (code === str.quoteCharCode) {
|
|
2639
|
+
this.startText();
|
|
2624
2640
|
this.pos++;
|
|
2625
2641
|
this.exitState();
|
|
2626
2642
|
} else if (!states_exports.checkForPlaceholder(this, code)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "htmljs-parser",
|
|
3
3
|
"description": "An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.5.0",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@changesets/changelog-github": "^0.4.7",
|
|
7
7
|
"@changesets/cli": "^2.25.2",
|