diff --git a/crates/djls-template-ast/SPEC.md b/crates/djls-template-ast/SPEC.md index 68c20ce..55a5e53 100644 --- a/crates/djls-template-ast/SPEC.md +++ b/crates/djls-template-ast/SPEC.md @@ -34,11 +34,12 @@ Enumeration of all possible node types in the AST. ```rust pub enum Node { - Text { + Block(Block), + Comment { content: String, span: Span, }, - Comment { + Text { content: String, span: Span, }, @@ -47,52 +48,6 @@ pub enum Node { filters: Vec, span: Span, }, - Block(Block), -} -``` - -#### `Node::Text` - -Represents raw text and HTML content outside of Django template tags. - -```rust -Node::Text { - content: String, // The raw text content - span: Span, // The position of the text in the template -} -``` - -#### `Node::Comment` - -Represents Django template comments (`{# ... #}`). - -```rust -Node::Comment { - content: String, // The comment content - span: Span, // The position of the comment in the template -} -``` - -#### `Node::Variable` - -Represents variable interpolation (`{{ variable|filter }}`). - -```rust -Node::Variable { - bits: Vec, // Components of the variable path - filters: Vec, // Filters applied to the variable - span: Span, // The position of the variable in the template -} -``` - -##### `DjangoFilter` - -Represents a filter applied to a variable. - -```rust -pub struct DjangoFilter { - pub name: String, // Name of the filter - pub args: Vec, // Arguments passed to the filter } ``` @@ -242,6 +197,51 @@ Examples: - `{% load %}` - `{% now "Y-m-d" %}` +#### `Node::Comment` + +Represents Django template comments (`{# ... #}`). + +```rust +Node::Comment { + content: String, // The comment content + span: Span, // The position of the comment in the template +} +``` + +#### `Node::Text` + +Represents raw text and HTML content outside of Django template tags. + +```rust +Node::Text { + content: String, // The raw text content + span: Span, // The position of the text in the template +} +``` + +#### `Node::Variable` + +Represents variable interpolation (`{{ variable|filter }}`). + +```rust +Node::Variable { + bits: Vec, // Components of the variable path + filters: Vec, // Filters applied to the variable + span: Span, // The position of the variable in the template +} +``` + +##### `DjangoFilter` + +Represents a filter applied to a variable. + +```rust +pub struct DjangoFilter { + pub name: String, // Name of the filter + pub args: Vec, // Arguments passed to the filter +} +``` + ## TagSpecs ### Schema