mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 19:33:32 -04:00
feat: Added mustache templating.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user