From 9d65db2a3a6267065d820962b1a9decb5a818ef3 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 4 Jan 2025 23:54:42 -0600 Subject: [PATCH] updates --- crates/djls-template-ast/src/parser.rs | 18 +- ...__tests__comments__parse_comments.snap.new | 19 ++ ...ts__django__parse_complex_if_elif.snap.new | 75 +++++ ...s__django__parse_django_for_block.snap.new | 58 ++++ ...ts__django__parse_django_if_block.snap.new | 38 +++ ...ts__django__parse_django_variable.snap.new | 22 ++ ...ests__django__parse_filter_chains.snap.new | 32 +++ ...ests__django__parse_mixed_content.snap.new | 256 ++++++++++++++++++ ...ests__django__parse_nested_for_if.snap.new | 67 +++++ ...sts__errors__parse_error_recovery.snap.new | 114 ++++++++ ...errors__parse_unclosed_django_for.snap.new | 33 +++ ..._errors__parse_unclosed_django_if.snap.new | 28 ++ ...__errors__parse_unclosed_html_tag.snap.new | 14 + ...ts__errors__parse_unclosed_script.snap.new | 14 + ...sts__errors__parse_unclosed_style.snap.new | 14 + ...tests__full_templates__parse_full.snap.new | 132 +++++++++ ...__tests__html__parse_html_doctype.snap.new | 14 + ...rser__tests__html__parse_html_tag.snap.new | 14 + ...ser__tests__html__parse_html_void.snap.new | 14 + ...rser__tests__script__parse_script.snap.new | 14 + ...parser__tests__style__parse_style.snap.new | 14 + 21 files changed, 998 insertions(+), 6 deletions(-) create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__comments__parse_comments.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_complex_if_elif.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_for_block.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_if_block.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_variable.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_filter_chains.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_mixed_content.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_nested_for_if.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_error_recovery.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_for.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_if.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_html_tag.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_script.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_style.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__full_templates__parse_full.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_doctype.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_tag.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_void.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__script__parse_script.snap.new create mode 100644 crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__style__parse_style.snap.new diff --git a/crates/djls-template-ast/src/parser.rs b/crates/djls-template-ast/src/parser.rs index 57779ee..e21ae27 100644 --- a/crates/djls-template-ast/src/parser.rs +++ b/crates/djls-template-ast/src/parser.rs @@ -162,7 +162,7 @@ impl Parser { bits, children: Some(branch_children), span: branch_span, - tag_span: tag_span.clone(), + tag_span, }); } let closing_token = self.peek_previous()?; @@ -171,7 +171,6 @@ impl Parser { _ => 0, }; total_length = (closing_token.start().unwrap_or(0) + closing_content) - as usize - start_pos as usize; children.push(Node::Block { block_type: BlockType::Closing, @@ -182,7 +181,7 @@ impl Parser { closing_token.start().unwrap_or(0) as u32, closing_content as u16, ), - tag_span: tag_span.clone(), + tag_span, }); found_closing_tag = true; break; @@ -199,7 +198,7 @@ impl Parser { bits, children: Some(branch_children), span: branch_span, - tag_span: tag_span.clone(), + tag_span, }); } // Create new branch node @@ -227,7 +226,7 @@ impl Parser { bits: bits.clone(), children: Some(children.clone()), span: Span::new(start_pos, total_length as u16), - tag_span: tag_span.clone(), + tag_span, }; return Err(ParserError::Ast(AstError::UnexpectedTag(tag), Some(node))); } @@ -268,6 +267,9 @@ impl Parser { let parts: Vec<&str> = s.split('|').collect(); let bits: Vec = parts[0].trim().split('.').map(String::from).collect(); + // Track position in the string for filter spans + let mut current_pos = parts[0].len() + 1; // +1 for the pipe + let filters: Vec = parts[1..] .iter() .map(|filter_str| { @@ -284,7 +286,11 @@ impl Parser { Vec::new() }; - DjangoFilter::new(name, arguments) + let filter_span = + Span::new(start_pos + current_pos as u32, filter_str.len() as u16); + current_pos += filter_str.len() + 1; // +1 for the pipe + + DjangoFilter::new(name, arguments, filter_span) }) .collect(); diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__comments__parse_comments.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__comments__parse_comments.snap.new new file mode 100644 index 0000000..7d9b0a8 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__comments__parse_comments.snap.new @@ -0,0 +1,19 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 605 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "" + span: + start: 0 + length: 21 + - Comment: + content: Django comment + span: + start: 21 + length: 18 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_complex_if_elif.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_complex_if_elif.snap.new new file mode 100644 index 0000000..571b55e --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_complex_if_elif.snap.new @@ -0,0 +1,75 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 524 +expression: ast +snapshot_kind: text +--- +nodes: + - Block: + block_type: Standard + name: if + bits: + - if + - x + - ">" + - "0" + children: + - Text: + content: Positive + span: + start: 14 + length: 8 + - Block: + block_type: Branch + name: elif + bits: + - x + - "<" + - "0" + children: + - Text: + content: Negative + span: + start: 38 + length: 8 + span: + start: 0 + length: 8 + tag_span: + start: 0 + length: 8 + - Block: + block_type: Branch + name: else + bits: [] + children: + - Text: + content: Zero + span: + start: 56 + length: 4 + span: + start: 0 + length: 8 + tag_span: + start: 0 + length: 8 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 60 + length: 5 + tag_span: + start: 0 + length: 8 + span: + start: 0 + length: 65 + tag_span: + start: 0 + length: 8 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_for_block.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_for_block.snap.new new file mode 100644 index 0000000..56c0eee --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_for_block.snap.new @@ -0,0 +1,58 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 515 +expression: ast +snapshot_kind: text +--- +nodes: + - Block: + block_type: Standard + name: for + bits: + - for + - item + - in + - items + children: + - Variable: + bits: + - item + filters: [] + span: + start: 23 + length: 4 + - Block: + block_type: Branch + name: empty + bits: [] + children: + - Text: + content: No items + span: + start: 44 + length: 8 + span: + start: 0 + length: 17 + tag_span: + start: 0 + length: 17 + - Block: + block_type: Closing + name: endfor + bits: [] + children: ~ + span: + start: 52 + length: 6 + tag_span: + start: 0 + length: 17 + span: + start: 0 + length: 58 + tag_span: + start: 0 + length: 17 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_if_block.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_if_block.snap.new new file mode 100644 index 0000000..8b4e5b9 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_if_block.snap.new @@ -0,0 +1,38 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 506 +expression: ast +snapshot_kind: text +--- +nodes: + - Block: + block_type: Standard + name: if + bits: + - if + - user.is_authenticated + children: + - Text: + content: Welcome + span: + start: 30 + length: 7 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 37 + length: 5 + tag_span: + start: 0 + length: 24 + span: + start: 0 + length: 42 + tag_span: + start: 0 + length: 24 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_variable.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_variable.snap.new new file mode 100644 index 0000000..a29fc77 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_django_variable.snap.new @@ -0,0 +1,22 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 488 +expression: ast +snapshot_kind: text +--- +nodes: + - Variable: + bits: + - user + - name + filters: + - name: title + arguments: [] + span: + start: 10 + length: 5 + span: + start: 0 + length: 15 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_filter_chains.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_filter_chains.snap.new new file mode 100644 index 0000000..c49ec1f --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_filter_chains.snap.new @@ -0,0 +1,32 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 497 +expression: ast +snapshot_kind: text +--- +nodes: + - Variable: + bits: + - value + filters: + - name: default + arguments: + - "'nothing'" + span: + start: 6 + length: 17 + - name: title + arguments: [] + span: + start: 24 + length: 5 + - name: upper + arguments: [] + span: + start: 30 + length: 5 + span: + start: 0 + length: 35 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_mixed_content.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_mixed_content.snap.new new file mode 100644 index 0000000..709af53 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_mixed_content.snap.new @@ -0,0 +1,256 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 555 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "Welcome, " + span: + start: 0 + length: 9 + - Block: + block_type: Standard + name: if + bits: + - if + - user.is_authenticated + children: + - Text: + content: "\n " + span: + start: 39 + length: 5 + - Variable: + bits: + - user + - name + filters: + - name: title + arguments: [] + span: + start: 54 + length: 5 + - name: default + arguments: + - "'Guest'" + span: + start: 60 + length: 15 + span: + start: 44 + length: 31 + - Text: + content: "\n " + span: + start: 81 + length: 5 + - Block: + block_type: Standard + name: for + bits: + - for + - group + - in + - user.groups + children: + - Text: + content: "\n " + span: + start: 116 + length: 9 + - Block: + block_type: Standard + name: if + bits: + - if + - forloop.first + children: + - Text: + content: ( + span: + start: 147 + length: 1 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 148 + length: 5 + tag_span: + start: 125 + length: 16 + span: + start: 125 + length: 28 + tag_span: + start: 125 + length: 16 + - Text: + content: "\n " + span: + start: 159 + length: 9 + - Variable: + bits: + - group + - name + filters: [] + span: + start: 168 + length: 10 + - Text: + content: "\n " + span: + start: 184 + length: 9 + - Block: + block_type: Standard + name: if + bits: + - if + - not + - forloop.last + children: + - Text: + content: ", " + span: + start: 218 + length: 2 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 220 + length: 5 + tag_span: + start: 193 + length: 19 + span: + start: 193 + length: 32 + tag_span: + start: 193 + length: 19 + - Text: + content: "\n " + span: + start: 231 + length: 9 + - Block: + block_type: Standard + name: if + bits: + - if + - forloop.last + children: + - Text: + content: ) + span: + start: 261 + length: 1 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 262 + length: 5 + tag_span: + start: 240 + length: 15 + span: + start: 240 + length: 27 + tag_span: + start: 240 + length: 15 + - Text: + content: "\n " + span: + start: 273 + length: 5 + - Block: + block_type: Branch + name: empty + bits: [] + children: + - Text: + content: "\n (no groups)\n " + span: + start: 289 + length: 25 + span: + start: 86 + length: 24 + tag_span: + start: 86 + length: 24 + - Block: + block_type: Closing + name: endfor + bits: [] + children: ~ + span: + start: 314 + length: 6 + tag_span: + start: 86 + length: 24 + span: + start: 86 + length: 234 + tag_span: + start: 86 + length: 24 + - Text: + content: "\n" + span: + start: 326 + length: 1 + - Block: + block_type: Branch + name: else + bits: [] + children: + - Text: + content: "\n Guest\n" + span: + start: 337 + length: 11 + span: + start: 9 + length: 24 + tag_span: + start: 9 + length: 24 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 348 + length: 5 + tag_span: + start: 9 + length: 24 + span: + start: 9 + length: 344 + tag_span: + start: 9 + length: 24 + - Text: + content: "!" + span: + start: 359 + length: 1 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_nested_for_if.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_nested_for_if.snap.new new file mode 100644 index 0000000..4292555 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__django__parse_nested_for_if.snap.new @@ -0,0 +1,67 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 534 +expression: ast +snapshot_kind: text +--- +nodes: + - Block: + block_type: Standard + name: for + bits: + - for + - item + - in + - items + children: + - Block: + block_type: Standard + name: if + bits: + - if + - item.active + children: + - Variable: + bits: + - item + - name + filters: [] + span: + start: 43 + length: 9 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 58 + length: 5 + tag_span: + start: 23 + length: 14 + span: + start: 23 + length: 40 + tag_span: + start: 23 + length: 14 + - Block: + block_type: Closing + name: endfor + bits: [] + children: ~ + span: + start: 69 + length: 6 + tag_span: + start: 0 + length: 17 + span: + start: 0 + length: 75 + tag_span: + start: 0 + length: 17 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_error_recovery.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_error_recovery.snap.new new file mode 100644 index 0000000..fd4780e --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_error_recovery.snap.new @@ -0,0 +1,114 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 681 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "
\n

Header

\n " + span: + start: 0 + length: 48 + - Block: + block_type: Standard + name: if + bits: + - if + - user.is_authenticated + children: + - Text: + content: "\n " + span: + start: 78 + length: 9 + - Comment: + content: This if is unclosed which does matter + span: + start: 87 + length: 41 + - Text: + content: "\n

Welcome " + span: + start: 130 + length: 20 + - Variable: + bits: + - user + - name + filters: [] + span: + start: 150 + length: 9 + - Text: + content: "

\n
\n " + span: + start: 165 + length: 31 + - Comment: + content: "This div is unclosed which doesn't matter" + span: + start: 196 + length: 45 + - Text: + content: "\n " + span: + start: 243 + length: 9 + - Block: + block_type: Standard + name: for + bits: + - for + - item + - in + - items + children: + - Text: + content: "\n " + span: + start: 275 + length: 19 + - Variable: + bits: + - item + filters: [] + span: + start: 294 + length: 4 + - Text: + content: "\n " + span: + start: 304 + length: 16 + - Block: + block_type: Closing + name: endfor + bits: [] + children: ~ + span: + start: 320 + length: 6 + tag_span: + start: 252 + length: 17 + span: + start: 252 + length: 74 + tag_span: + start: 252 + length: 17 + - Text: + content: "\n
Page Footer
\n
" + span: + start: 332 + length: 40 + span: + start: 48 + length: 24 + tag_span: + start: 48 + length: 24 +line_offsets: [] +errors: + - UnclosedTag: if diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_for.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_for.snap.new new file mode 100644 index 0000000..46fee1d --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_for.snap.new @@ -0,0 +1,33 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 639 +expression: ast +snapshot_kind: text +--- +nodes: + - Block: + block_type: Standard + name: for + bits: + - for + - item + - in + - items + children: + - Variable: + bits: + - item + - name + filters: [] + span: + start: 23 + length: 9 + span: + start: 0 + length: 17 + tag_span: + start: 0 + length: 17 +line_offsets: [] +errors: + - UnclosedTag: for diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_if.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_if.snap.new new file mode 100644 index 0000000..c45d407 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_django_if.snap.new @@ -0,0 +1,28 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 628 +expression: ast +snapshot_kind: text +--- +nodes: + - Block: + block_type: Standard + name: if + bits: + - if + - user.is_authenticated + children: + - Text: + content: Welcome + span: + start: 30 + length: 7 + span: + start: 0 + length: 24 + tag_span: + start: 0 + length: 24 +line_offsets: [] +errors: + - UnclosedTag: if diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_html_tag.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_html_tag.snap.new new file mode 100644 index 0000000..647a075 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_html_tag.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 618 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "
" + span: + start: 0 + length: 5 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_script.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_script.snap.new new file mode 100644 index 0000000..6ea7c53 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__errors__parse_unclosed_script.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 650 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "\n \n \n \n
\n " + span: + start: 0 + length: 463 + - Block: + block_type: Standard + name: if + bits: + - if + - user.is_authenticated + children: + - Text: + content: "\n " + span: + start: 493 + length: 17 + - Comment: + content: Welcome message + span: + start: 510 + length: 19 + - Text: + content: "\n

Welcome, " + span: + start: 531 + length: 30 + - Variable: + bits: + - user + - name + filters: + - name: title + arguments: [] + span: + start: 571 + length: 5 + - name: default + arguments: + - "'Guest'" + span: + start: 577 + length: 15 + span: + start: 561 + length: 31 + - Text: + content: "!

\n " + span: + start: 598 + length: 23 + - Block: + block_type: Standard + name: if + bits: + - if + - user.is_staff + children: + - Text: + content: "\n Admin\n " + span: + start: 643 + length: 56 + - Block: + block_type: Branch + name: else + bits: [] + children: + - Text: + content: "\n User\n " + span: + start: 709 + length: 55 + span: + start: 621 + length: 16 + tag_span: + start: 621 + length: 16 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 764 + length: 5 + tag_span: + start: 621 + length: 16 + span: + start: 621 + length: 148 + tag_span: + start: 621 + length: 16 + - Text: + content: "\n " + span: + start: 775 + length: 13 + - Block: + block_type: Closing + name: endif + bits: [] + children: ~ + span: + start: 788 + length: 5 + tag_span: + start: 463 + length: 24 + span: + start: 463 + length: 330 + tag_span: + start: 463 + length: 24 + - Text: + content: "\n
\n \n" + span: + start: 799 + length: 35 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_doctype.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_doctype.snap.new new file mode 100644 index 0000000..a4f6d9a --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_doctype.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 457 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "" + span: + start: 0 + length: 15 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_tag.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_tag.snap.new new file mode 100644 index 0000000..dc261f3 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_tag.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 466 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "
Hello
" + span: + start: 0 + length: 34 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_void.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_void.snap.new new file mode 100644 index 0000000..8227966 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__html__parse_html_void.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 475 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "" + span: + start: 0 + length: 21 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__script__parse_script.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__script__parse_script.snap.new new file mode 100644 index 0000000..83d9d14 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__script__parse_script.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 574 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "" + span: + start: 0 + length: 142 +line_offsets: [] +errors: [] diff --git a/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__style__parse_style.snap.new b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__style__parse_style.snap.new new file mode 100644 index 0000000..3005c45 --- /dev/null +++ b/crates/djls-template-ast/src/snapshots/djls_template_ast__parser__tests__style__parse_style.snap.new @@ -0,0 +1,14 @@ +--- +source: crates/djls-template-ast/src/parser.rs +assertion_line: 592 +expression: ast +snapshot_kind: text +--- +nodes: + - Text: + content: "" + span: + start: 0 + length: 97 +line_offsets: [] +errors: []