Example #1
0
func (t *Template) CreateTemplate() (string, error) {
	tpl, err := pongo.FromFile(t.Source, nil)
	if err != nil {
		return "", err
	}
	ctx := pongo.Context(t.Context)
	out, err := tpl.Execute(&ctx)
	if err != nil {
		return "", err
	}
	return *out, nil
}
Example #2
0
File: pongo.go Project: murz/ego
func (tpl PongoTemplate) ExecuteRW(w http.ResponseWriter, ctx map[string]interface{}) error {
	pctx := pongo.Context(ctx)
	return tpl.tmpl.ExecuteRW(w, &pctx)
}