Migrate jqhtml slot syntax from <#name> to <Slot:name>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-24 03:43:45 +00:00
parent 22df126977
commit 881425bed6
35 changed files with 124 additions and 122 deletions

View File

@@ -251,7 +251,7 @@ export class Parser {
if (this.match(TokenType.CODE_START)) {
return this.parse_code_block();
}
// Slot <#name>...</#name>
// Slot <Slot:name>...</Slot:name>
if (this.match(TokenType.SLOT_START)) {
return this.parse_slot();
}
@@ -315,7 +315,7 @@ export class Parser {
// Other problematic words
'arguments', 'eval'
]);
// Parse slot <#name>content</#name> or <#name />
// Parse slot <Slot:name>content</Slot:name> or <Slot:name />
parse_slot() {
const start_token = this.previous(); // SLOT_START
const name_token = this.consume(TokenType.SLOT_NAME, 'Expected slot name');
@@ -351,7 +351,7 @@ export class Parser {
}
}
// Consume closing tag
this.consume(TokenType.SLOT_END, 'Expected </#');
this.consume(TokenType.SLOT_END, 'Expected </Slot:');
const closing_name = this.consume(TokenType.SLOT_NAME, 'Expected slot name');
if (closing_name.value !== name_token.value) {
throw mismatchedTagError(name_token.value, closing_name.value, closing_name.line, closing_name.column, this.source, this.filename);
@@ -810,7 +810,7 @@ export class Parser {
}
// If component has both slots and non-slot content, throw error
if (hasSlots && hasNonSlotContent) {
throw syntaxError(`Mixed content not allowed: when using slots, all content must be inside <#slotname> tags`, startToken.line, startToken.column, this.source, this.filename);
throw syntaxError(`Mixed content not allowed: when using slots, all content must be inside <Slot:slotname> tags`, startToken.line, startToken.column, this.source, this.filename);
}
}
/**