feat: Added mustache templating.

This commit is contained in:
Spencer Brower
2026-07-12 13:38:32 -04:00
parent 42d58394ef
commit 8b2dceb679
40 changed files with 7838 additions and 163 deletions
+11
View File
@@ -0,0 +1,11 @@
Hello, {{name}}!
Languages you know:
{{#languages}}
- {{.}}
{{/languages}}
{{#show_footer}}
---
Rendered with odin-mustache.
{{/show_footer}}
+28
View File
@@ -0,0 +1,28 @@
package main
import "core:fmt"
import "core:os"
import mustache "../.."
Person :: struct {
name: string,
languages: []string,
show_footer: bool,
}
main :: proc() {
data := Person{
name = "World",
languages = {"Odin", "C", "Rust"},
show_footer = true,
}
result, err := mustache.render_from_filename("hello.mustache", data)
if err != nil {
fmt.eprintfln("render error: %v", err)
os.exit(1)
}
fmt.print(result)
}