-
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(parser/html): fix incorrect parsing when text starts with a quote
- Loading branch information
Showing
5 changed files
with
132 additions
and
24 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
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 |
---|---|---|
|
@@ -82,10 +82,7 @@ HtmlRoot { | |
}, | ||
}, | ||
HtmlContent { | ||
value_token: HTML_LITERAL@38..46 "some" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], | ||
}, | ||
HtmlContent { | ||
value_token: HTML_LITERAL@46..50 "text" [] [], | ||
value_token: HTML_LITERAL@38..50 "some text" [Newline("\n"), Whitespace("\t\t")] [], | ||
}, | ||
HtmlElement { | ||
opening_element: HtmlOpeningElement { | ||
|
@@ -419,11 +416,9 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
2: [email protected] | ||
0: [email protected] "some" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] | ||
3: [email protected] | ||
0: [email protected] "text" [] [] | ||
4: [email protected] | ||
2: [email protected] | ||
0: [email protected] "some text" [Newline("\n"), Whitespace("\t\t")] [] | ||
3: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n"), Whitespace("\t\t")] [] | ||
1: [email protected] | ||
|
@@ -437,7 +432,7 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
5: [email protected] | ||
4: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n"), Whitespace("\t\t")] [] | ||
1: [email protected] | ||
|
@@ -451,7 +446,7 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
6: [email protected] | ||
5: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n"), Whitespace("\t\t")] [] | ||
1: [email protected] | ||
|
@@ -465,7 +460,7 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
7: [email protected] | ||
6: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n"), Whitespace("\t\t")] [] | ||
1: [email protected] | ||
|
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 |
---|---|---|
|
@@ -48,10 +48,7 @@ HtmlRoot { | |
}, | ||
}, | ||
HtmlContent { | ||
value_token: HTML_LITERAL@21..27 "some" [Newline("\n")] [Whitespace(" ")], | ||
}, | ||
HtmlContent { | ||
value_token: HTML_LITERAL@27..31 "text" [] [], | ||
value_token: HTML_LITERAL@21..31 "some text" [Newline("\n")] [], | ||
}, | ||
HtmlElement { | ||
opening_element: HtmlOpeningElement { | ||
|
@@ -140,11 +137,9 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
3: [email protected] | ||
0: [email protected] "some" [Newline("\n")] [Whitespace(" ")] | ||
4: [email protected] | ||
0: [email protected] "text" [] [] | ||
5: [email protected] | ||
3: [email protected] | ||
0: [email protected] "some text" [Newline("\n")] [] | ||
4: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n")] [] | ||
1: [email protected] | ||
|
@@ -158,7 +153,7 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
6: [email protected] | ||
5: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n")] [] | ||
1: [email protected] | ||
|
@@ -172,7 +167,7 @@ HtmlRoot { | |
2: [email protected] | ||
0: [email protected] "div" [] [] | ||
3: [email protected] ">" [] [] | ||
7: [email protected] | ||
6: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [Newline("\n")] [] | ||
1: [email protected] | ||
|
1 change: 1 addition & 0 deletions
1
crates/biome_html_parser/tests/html_specs/ok/quote-in-child.html
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 @@ | ||
<p>"<span>Foo</span>" is the title.</p> |
117 changes: 117 additions & 0 deletions
117
crates/biome_html_parser/tests/html_specs/ok/quote-in-child.html.snap
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,117 @@ | ||
--- | ||
source: crates/biome_html_parser/tests/spec_test.rs | ||
expression: snapshot | ||
--- | ||
## Input | ||
|
||
```html | ||
<p>"<span>Foo</span>" is the title.</p> | ||
``` | ||
|
||
|
||
## AST | ||
|
||
``` | ||
HtmlRoot { | ||
bom_token: missing (optional), | ||
directive: missing (optional), | ||
html: HtmlElementList [ | ||
HtmlElement { | ||
opening_element: HtmlOpeningElement { | ||
l_angle_token: L_ANGLE@0..1 "<" [] [], | ||
name: HtmlName { | ||
value_token: HTML_LITERAL@1..2 "p" [] [], | ||
}, | ||
attributes: HtmlAttributeList [], | ||
r_angle_token: R_ANGLE@2..3 ">" [] [], | ||
}, | ||
children: HtmlElementList [ | ||
HtmlContent { | ||
value_token: HTML_LITERAL@3..4 "\"" [] [], | ||
}, | ||
HtmlElement { | ||
opening_element: HtmlOpeningElement { | ||
l_angle_token: L_ANGLE@4..5 "<" [] [], | ||
name: HtmlName { | ||
value_token: HTML_LITERAL@5..9 "span" [] [], | ||
}, | ||
attributes: HtmlAttributeList [], | ||
r_angle_token: R_ANGLE@9..10 ">" [] [], | ||
}, | ||
children: HtmlElementList [ | ||
HtmlContent { | ||
value_token: HTML_LITERAL@10..13 "Foo" [] [], | ||
}, | ||
], | ||
closing_element: HtmlClosingElement { | ||
l_angle_token: L_ANGLE@13..14 "<" [] [], | ||
slash_token: SLASH@14..15 "/" [] [], | ||
name: HtmlName { | ||
value_token: HTML_LITERAL@15..19 "span" [] [], | ||
}, | ||
r_angle_token: R_ANGLE@19..20 ">" [] [], | ||
}, | ||
}, | ||
HtmlContent { | ||
value_token: HTML_LITERAL@20..35 "\" is the title." [] [], | ||
}, | ||
], | ||
closing_element: HtmlClosingElement { | ||
l_angle_token: L_ANGLE@35..36 "<" [] [], | ||
slash_token: SLASH@36..37 "/" [] [], | ||
name: HtmlName { | ||
value_token: HTML_LITERAL@37..38 "p" [] [], | ||
}, | ||
r_angle_token: R_ANGLE@38..39 ">" [] [], | ||
}, | ||
}, | ||
], | ||
eof_token: EOF@39..40 "" [Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: [email protected] | ||
0: (empty) | ||
1: (empty) | ||
2: [email protected] | ||
0: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] | ||
0: [email protected] "p" [] [] | ||
2: [email protected] | ||
3: [email protected] ">" [] [] | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] "\"" [] [] | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] | ||
0: [email protected] "span" [] [] | ||
2: [email protected] | ||
3: [email protected] ">" [] [] | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] "Foo" [] [] | ||
2: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] "/" [] [] | ||
2: [email protected] | ||
0: [email protected] "span" [] [] | ||
3: [email protected] ">" [] [] | ||
2: [email protected] | ||
0: [email protected] "\" is the title." [] [] | ||
2: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] "/" [] [] | ||
2: [email protected] | ||
0: [email protected] "p" [] [] | ||
3: [email protected] ">" [] [] | ||
3: [email protected] "" [Newline("\n")] [] | ||
``` |