By {{fullName author}}
{{body}}
Comments
{{#each comments}}By {{fullName author}}
{{body}}
{{/each}}
package raymond import "fmt" func Example() { source := "
{{body.content}}
" ctx := map[string]interface{}{ "title": "foo", "body": map[string]string{"content": "bar"}, } // parse template tpl := MustParse(source) // evaluate template with context output := tpl.MustExec(ctx) // alternatively, for one shots: // output := MustRender(source, ctx) fmt.Print(output) // Output:bar
} func Example_struct() { source := `{{body.content}}
" ctx := map[string]interface{}{ "title": "foo", "body": map[string]string{"content": "bar"}, } // render template with context output, err := Render(tpl, ctx) if err != nil { panic(err) } fmt.Print(output) // Output:bar
} func ExampleMustRender() { tpl := "{{body.content}}
" ctx := map[string]interface{}{ "title": "foo", "body": map[string]string{"content": "bar"}, } // render template with context output := MustRender(tpl, ctx) fmt.Print(output) // Output:bar
}