shared/util.go
func RenderTemplate(template string, ctx pongo2.Context) (string, error) {
	// Load template from string
	tpl, err := pongo2.FromString("{% autoescape off %}" + template + "{% endautoescape %}")
	if err != nil {
		return "", err
	}

	// Get rendered template
	ret, err := tpl.Execute(ctx)
	if err != nil {
		return ret, err
	}

	// Looks like we're nesting templates so run pongo again
	if strings.Contains(ret, "{{") || strings.Contains(ret, "{%") {
		return RenderTemplate(ret, ctx)
	}

	return ret, err
}
func RenderTemplate(template string, ctx pongo2.Context) (string, error) {
	// Load template from string
	tpl, err := pongo2.FromString("{% autoescape off %}" + template + "{% endautoescape %}")
	if err != nil {
		return "", err
	}

	// Get rendered template
	ret, err := tpl.Execute(ctx)
	if err != nil {
		return ret, err
	}

	// Looks like we're nesting templates so run pongo again
	if strings.Contains(ret, "{{") || strings.Contains(ret, "{%") {
		return RenderTemplate(ret, ctx)
	}

	return ret, err
}
func RenderTemplate ( template string , ctx pongo2 . Context ) ( string , error ) { // Load template from string tpl , err := pongo2 . FromString ( " " + template + " " ) if err != nil { return " " , err } // Get rendered template ret , err := tpl . Execute ( ctx ) if err != nil { return ret , err } // Looks like we're nesting templates so run pongo again if strings . Contains ( ret , " " ) || strings . Contains ( ret , " " ) { return RenderTemplate ( ret , ctx ) } return ret , err }
// RenderTemplate renders a pongo2 template.
RenderTemplate renders a pongo2 template .