-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve handling of comas, especially for concise mode
- Loading branch information
1 parent
61e6966
commit 6b5b196
Showing
7 changed files
with
171 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"htmljs-parser": minor | ||
--- | ||
|
||
In concise mode, a new line which starts with a coma will now continue attributes for the current tag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"htmljs-parser": minor | ||
--- | ||
|
||
Allow a comma to follow the tag name to begin attributes. |
122 changes: 122 additions & 0 deletions
122
src/__tests__/fixtures/coma-after-open-tag/__snapshots__/coma-after-open-tag.expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
1╭─ div, class="a", id="c" | ||
│ │ │ ││ │ │╰─ attrValue.value "\"c\"" | ||
│ │ │ ││ │ ╰─ attrValue "=\"c\"" | ||
│ │ │ ││ ╰─ attrName "id" | ||
│ │ │ │╰─ attrValue.value "\"a\"" | ||
│ │ │ ╰─ attrValue "=\"a\"" | ||
│ │ ╰─ attrName "class" | ||
╰─ ╰─ tagName "div" | ||
2╭─ | ||
╰─ ╰─ openTagEnd | ||
3╭─ div, | ||
│ ├─ closeTagEnd(div) | ||
╰─ ╰─ tagName "div" | ||
4╭─ class="a", | ||
│ │ │╰─ attrValue.value "\"a\"" | ||
│ │ ╰─ attrValue "=\"a\"" | ||
╰─ ╰─ attrName "class" | ||
5╭─ id="c" | ||
│ │ │╰─ attrValue.value "\"c\"" | ||
│ │ ╰─ attrValue "=\"c\"" | ||
╰─ ╰─ attrName "id" | ||
6╭─ | ||
╰─ ╰─ openTagEnd | ||
7╭─ div , class="a", id="c" | ||
│ │ │ ││ │ │╰─ attrValue.value "\"c\"" | ||
│ │ │ ││ │ ╰─ attrValue "=\"c\"" | ||
│ │ │ ││ ╰─ attrName "id" | ||
│ │ │ │╰─ attrValue.value "\"a\"" | ||
│ │ │ ╰─ attrValue "=\"a\"" | ||
│ │ ╰─ attrName "class" | ||
│ ├─ closeTagEnd(div) | ||
╰─ ╰─ tagName "div" | ||
8╭─ | ||
╰─ ╰─ openTagEnd | ||
9╭─ div , | ||
│ ├─ closeTagEnd(div) | ||
╰─ ╰─ tagName "div" | ||
10╭─ class="a", | ||
│ │ │╰─ attrValue.value "\"a\"" | ||
│ │ ╰─ attrValue "=\"a\"" | ||
╰─ ╰─ attrName "class" | ||
11╭─ id="c" | ||
│ │ │╰─ attrValue.value "\"c\"" | ||
│ │ ╰─ attrValue "=\"c\"" | ||
╰─ ╰─ attrName "id" | ||
12╭─ | ||
╰─ ╰─ openTagEnd | ||
13╭─ div | ||
│ ├─ closeTagEnd(div) | ||
╰─ ╰─ tagName "div" | ||
14╭─ ,class="a" | ||
│ │ │╰─ attrValue.value "\"a\"" | ||
│ │ ╰─ attrValue "=\"a\"" | ||
╰─ ╰─ attrName "class" | ||
15╭─ ,id="c" | ||
│ │ │╰─ attrValue.value "\"c\"" | ||
│ │ ╰─ attrValue "=\"c\"" | ||
╰─ ╰─ attrName "id" | ||
16╭─ | ||
╰─ ╰─ openTagEnd | ||
17╭─ <div, class="a", id="c"/> | ||
│ ││ │ ││ │ ││ ╰─ openTagEnd:selfClosed "/>" | ||
│ ││ │ ││ │ │╰─ attrValue.value "\"c\"" | ||
│ ││ │ ││ │ ╰─ attrValue "=\"c\"" | ||
│ ││ │ ││ ╰─ attrName "id" | ||
│ ││ │ │╰─ attrValue.value "\"a\"" | ||
│ ││ │ ╰─ attrValue "=\"a\"" | ||
│ ││ ╰─ attrName "class" | ||
│ │╰─ tagName "div" | ||
│ ├─ closeTagEnd(div) | ||
╰─ ╰─ openTagStart | ||
18├─ | ||
19╭─ <div, | ||
│ │╰─ tagName "div" | ||
╰─ ╰─ openTagStart | ||
20╭─ class="a", | ||
│ │ │╰─ attrValue.value "\"a\"" | ||
│ │ ╰─ attrValue "=\"a\"" | ||
╰─ ╰─ attrName "class" | ||
21╭─ id="c"/> | ||
│ │ ││ ╰─ openTagEnd:selfClosed "/>" | ||
│ │ │╰─ attrValue.value "\"c\"" | ||
│ │ ╰─ attrValue "=\"c\"" | ||
╰─ ╰─ attrName "id" | ||
22├─ | ||
23╭─ <div , class="a", id="c"/> | ||
│ ││ │ ││ │ ││ ╰─ openTagEnd:selfClosed "/>" | ||
│ ││ │ ││ │ │╰─ attrValue.value "\"c\"" | ||
│ ││ │ ││ │ ╰─ attrValue "=\"c\"" | ||
│ ││ │ ││ ╰─ attrName "id" | ||
│ ││ │ │╰─ attrValue.value "\"a\"" | ||
│ ││ │ ╰─ attrValue "=\"a\"" | ||
│ ││ ╰─ attrName "class" | ||
│ │╰─ tagName "div" | ||
╰─ ╰─ openTagStart | ||
24├─ | ||
25╭─ <div , | ||
│ │╰─ tagName "div" | ||
╰─ ╰─ openTagStart | ||
26╭─ class="a", | ||
│ │ │╰─ attrValue.value "\"a\"" | ||
│ │ ╰─ attrValue "=\"a\"" | ||
╰─ ╰─ attrName "class" | ||
27╭─ id="c"/> | ||
│ │ ││ ╰─ openTagEnd:selfClosed "/>" | ||
│ │ │╰─ attrValue.value "\"c\"" | ||
│ │ ╰─ attrValue "=\"c\"" | ||
╰─ ╰─ attrName "id" | ||
28├─ | ||
29╭─ <div | ||
│ │╰─ tagName "div" | ||
╰─ ╰─ openTagStart | ||
30╭─ ,class="a" | ||
│ │ │╰─ attrValue.value "\"a\"" | ||
│ │ ╰─ attrValue "=\"a\"" | ||
╰─ ╰─ attrName "class" | ||
31╭─ ,id="c"/> | ||
│ │ ││ ╰─ openTagEnd:selfClosed "/>" | ||
│ │ │╰─ attrValue.value "\"c\"" | ||
│ │ ╰─ attrValue "=\"c\"" | ||
╰─ ╰─ attrName "id" | ||
32╰─ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
div, class="a", id="c" | ||
|
||
div, | ||
class="a", | ||
id="c" | ||
|
||
div , class="a", id="c" | ||
|
||
div , | ||
class="a", | ||
id="c" | ||
|
||
div | ||
,class="a" | ||
,id="c" | ||
|
||
<div, class="a", id="c"/> | ||
|
||
<div, | ||
class="a", | ||
id="c"/> | ||
|
||
<div , class="a", id="c"/> | ||
|
||
<div , | ||
class="a", | ||
id="c"/> | ||
|
||
<div | ||
,class="a" | ||
,id="c"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters