isml-linter 5.43.6 → 5.43.8
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/CHANGELOG.md +14 -2
- package/package.json +1 -1
- package/src/isml_tree/IsmlNode.js +4 -1
- package/src/rules/tree/indent.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.43.8] - 2023-03-04
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Identification of HTML tag attributes even when there is no blank space separating them;
|
|
7
|
+
|
|
8
|
+
## [5.43.7] - 2023-03-03
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- "indent" rule - keep tag type if previous element has trailing spaces;
|
|
12
|
+
|
|
3
13
|
## [5.43.6] - 2023-02-25
|
|
4
14
|
|
|
5
15
|
### Fixed
|
|
6
|
-
- "indent"
|
|
16
|
+
- "indent" rule - don't add indentation to embbeded "isprint" tag if it's in the same line as previous attribute;
|
|
7
17
|
|
|
8
18
|
## [5.43.5] - 2023-02-21
|
|
9
19
|
|
|
10
20
|
### Fixed
|
|
11
|
-
- "indent"
|
|
21
|
+
- "indent" rule - keep indentation of closing tag that is in same line as corresponding opening tag;
|
|
12
22
|
- Tree build for an empty template;
|
|
13
23
|
|
|
14
24
|
## [5.43.4] - 2023-02-20
|
|
@@ -1119,6 +1129,8 @@
|
|
|
1119
1129
|
### Added
|
|
1120
1130
|
- Linter is published;
|
|
1121
1131
|
|
|
1132
|
+
[5.43.8]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.7...v5.43.8
|
|
1133
|
+
[5.43.7]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.6...v5.43.7
|
|
1122
1134
|
[5.43.6]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.5...v5.43.6
|
|
1123
1135
|
[5.43.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.4...v5.43.5
|
|
1124
1136
|
[5.43.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.3...v5.43.4
|
package/package.json
CHANGED
|
@@ -450,7 +450,7 @@ const getAttributes = node => {
|
|
|
450
450
|
const firstSpaceAfterTagPos = ParseUtils.getFirstEmptyCharPos(trimmedHead);
|
|
451
451
|
const leadingEmptySpaceQty = ParseUtils.getNextNonEmptyCharPos(nodeHead);
|
|
452
452
|
const afterTagContent = nodeHead.substring(leadingEmptySpaceQty + firstSpaceAfterTagPos);
|
|
453
|
-
const rawAttributeList = getStringifiedAttributeArray(afterTagContent);
|
|
453
|
+
const rawAttributeList = getStringifiedAttributeArray(afterTagContent.trim());
|
|
454
454
|
const attributeList = [];
|
|
455
455
|
|
|
456
456
|
for (let i = 0; i < rawAttributeList.length; i++) {
|
|
@@ -500,6 +500,7 @@ const getStringifiedAttributeArray = content => {
|
|
|
500
500
|
|
|
501
501
|
const maskedAttributeList = maskedContent
|
|
502
502
|
.replace(/><+/g, '> <')
|
|
503
|
+
.replace(/"</g, '" <')
|
|
503
504
|
.replace(/\s\s+/g, ' ')
|
|
504
505
|
.split(' ')
|
|
505
506
|
.filter(attr => attr);
|
|
@@ -509,6 +510,8 @@ const getStringifiedAttributeArray = content => {
|
|
|
509
510
|
attrStartPosList.push(i);
|
|
510
511
|
} else if (maskedContent[i - 1] === ' ' && maskedContent[i] !== ' ' || maskedContent[i - 1] === '>' && maskedContent[i] === '<') {
|
|
511
512
|
attrStartPosList.push(i);
|
|
513
|
+
} else if (maskedContent[i - 1] === '"' && maskedContent[i] === '<') {
|
|
514
|
+
attrStartPosList.push(i + 1);
|
|
512
515
|
}
|
|
513
516
|
}
|
|
514
517
|
|
package/src/rules/tree/indent.js
CHANGED
|
@@ -619,17 +619,18 @@ const addIndentation = (node, isOpeningTag) => {
|
|
|
619
619
|
const nodeIndentation = node.isInSameLineAsParent() && isOpeningTag ? '' : Rule.getIndentation(node.depth - 1);
|
|
620
620
|
const attributeOffset = Rule.getAttributeIndentationOffset();
|
|
621
621
|
const attributeList = node.getAttributeList();
|
|
622
|
+
const leadingLineBreakQty = ParseUtils.getLeadingLineBreakQty(node.head);
|
|
622
623
|
let contentResult = '';
|
|
623
624
|
|
|
624
625
|
if (isOpeningTag) {
|
|
625
626
|
const shouldAddIndentationToClosingChar = shouldAddIndentationToClosingChars(node);
|
|
626
627
|
const closingChars = getClosingChars(node);
|
|
627
|
-
const tagNameEndPos =
|
|
628
|
+
const tagNameEndPos = leadingLineBreakQty
|
|
628
629
|
+ ParseUtils.getFirstEmptyCharPos(node.head.trim()) + 1;
|
|
629
630
|
|
|
630
631
|
if (ParseUtils.getLineBreakQty(node.head.trim()) > 0 || shouldAddIndentationToClosingChar && node.isSelfClosing()) {
|
|
631
632
|
contentResult = attributeList.length > 0 ?
|
|
632
|
-
node.head.substring(0, tagNameEndPos).trimStart() :
|
|
633
|
+
node.head.trimStart().substring(0, tagNameEndPos - leadingLineBreakQty).trimStart() :
|
|
633
634
|
node.head.trimStart();
|
|
634
635
|
|
|
635
636
|
for (let i = 0; i < attributeList.length; i++) {
|
|
@@ -662,7 +663,7 @@ const removeAllIndentation = node => {
|
|
|
662
663
|
if (!node.isRoot() && !node.isContainer() && !node.parent.isOneOfTypes(['isscript', 'script'])) {
|
|
663
664
|
|
|
664
665
|
const shouldRemoveHeadIndentation = node.head && !node.isInSameLineAsPreviousSibling() && !node.isInSameLineAsParent() && !(node.lineNumber === node.parent.endLineNumber);
|
|
665
|
-
const shouldRemoveTailIndentation = node.tail && !(node.hasChildren() && node.getLastChild().lineNumber === node.tailLineNumber);
|
|
666
|
+
const shouldRemoveTailIndentation = !!(node.tail && !(node.hasChildren() && node.getLastChild().lineNumber === node.tailLineNumber));
|
|
666
667
|
|
|
667
668
|
if (shouldRemoveHeadIndentation) {
|
|
668
669
|
node.head = removeIndentation(node.head);
|