🍯 Glaze

package template_tests

/*{
		test_string :=
			"{{baz}}{{foobar}}{{foo}}{{bar}} {{ubar}}{{foo}}" +
			"
    " + "{{#test_array}}" + "
  • {{.}}
  • " + "{{/test_array}}" + "{{#test_array_block}}" + "
  • {{foo}}
  • " + "
  • {{bar}}
  • " + "{{/test_array_block}}" + "{{#test_block}}" + "
  • {{foo}}
  • " + "
  • {{bar}}
  • " + "{{/test_block}}" + "{{#test_struct}}" + "
  • {{spam}}
  • " + "{{/test_struct}}" + "
" Test_Block :: struct { foo: string, bar: string, } Test_Data :: struct { foo: int, bar: string, foobar: ^int, ubar: string, baz: f32, test_array: []int, test_array_block: []Test_Block, test_block: ^Test_Block, test_struct: struct { spam: int, }, } foobar := 1337 test_block := Test_Block { foo = "Foo", bar = "Bar", } test_data := Test_Data { foo = 42, bar = "Hello", foobar = &foobar, ubar = "Goodbye World", baz = 42.1337, test_array = {1, 2, 3, 4}, test_array_block = {{"baz", "baz"}, {"Key", "Value"}}, test_block = &test_block, test_struct = {spam = 7}, } b: strings.Builder strings.builder_init(&b) defer strings.builder_destroy(&b) tpl := template.compile(test_string) template.parse(&tpl, &b, test_data) template.destroy(&tpl) fmt.printf("%s\n", strings.to_string(b)) }*/