Skip to content

Commit 226aae7

Browse files
committed
feat(parser): Add conditional support inside each blocks
- Modify parseEachBody method in StatementParser to handle conditional tags - Enable if/else, elseif, and not conditions within each loops - Maintain nested conditional support inside iterations - Preserve existing each block functionality Example: {{#each items}} {{#if condition}} content {{/if}} {{/each}}
1 parent c0c686b commit 226aae7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/STE/parser/StatementParser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ export class StatementParser extends BaseParser {
245245
})
246246
} else if (this.match(TokenType.TAG_EACH)) {
247247
body.push(this.parseEach())
248+
} else if (this.match(TokenType.TAG_CONDITIONAL)) {
249+
body.push(this.parseConditional())
248250
} else {
249251
const expr = this.expressionParser.parseExpression()
250252
this.consume(TokenType.DOUBLE_BRACE_CLOSE, "Expect '}}' after expression.")

0 commit comments

Comments
 (0)