Author:ptrace
Comitter:ptrace
Date:2026-03-15 15:41:33 UTC
diff --git a/htmltemplate/lib.jai b/htmltemplate/lib.jai
index b163274..3cd0006 100644
--- a/htmltemplate/lib.jai
+++ b/htmltemplate/lib.jai
@@ -114,7 +114,7 @@ commit :: (queue_action: *[..]Action, id: string, value: [][]string) {
array_add(queue_action, action);
}
commit :: (queue_action: *[..]Action, id: string, value: ..string) {
commit :: (queue_action: *[..]Action, id: string, value: []string) {
action: Action = {
id = id,
flat = value,
@@ -123,8 +123,15 @@ commit :: (queue_action: *[..]Action, id: string, value: ..string) {
array_add(queue_action, action);
}
commit :: (queue_action: *[..]Action, id: string, value: []string) {
commit(queue_action, id, ..value);
/** TODO(adam, 5): If not inlined it will result in bogus data in `queue_action`.
This is quite janky. Investigate.
*/
commit :: inline (queue_action: *[..]Action, id: string, value: string) {
commit(queue_action, id, .[value]);
}
commit :: inline (queue_action: *[..]Action, id: string, value: ..string) {
commit(queue_action, id, value);
}
commit :: (id: string, value: [][]string) #expand {
@@ -177,6 +184,16 @@ Expected type: `[][]string`.
STR_END;
/** Note(adam): To reduce confusion why Token_Kind is set on two places:
When using `commit()` we set a Token_Kind.
When creating a token, we also set a Token_Kind.
The reason is, that we're able to check the syntax in the template
versus the supplied data structure in `commit()`.
If it does not match, we bail. See `assert_kind()`.
*/
Token_Kind :: enum u8 {
NONE :: 0;
@@ -193,8 +210,8 @@ Token :: struct {
}
Value :: union kind: Token_Kind {
flat: []string;
nested: [][]string;
.REPLACE ,, flat: []string;
.LOOP ,, nested: [][]string;
}
Replace_Token :: struct {