MCPcopy
hub / github.com/flosch/pongo2 / RenderTemplateString

Method RenderTemplateString

template_sets.go:255–264  ·  view source on GitHub ↗

RenderTemplateString is a shortcut and renders a template string directly.

(s string, ctx Context)

Source from the content-addressed store, hash-verified

253
254// RenderTemplateString is a shortcut and renders a template string directly.
255func (set *TemplateSet) RenderTemplateString(s string, ctx Context) (string, error) {
256 set.markFirstTemplateCreated()
257
258 tpl := Must(set.FromString(s))
259 result, err := tpl.Execute(ctx)
260 if err != nil {
261 return "", err
262 }
263 return result, nil
264}
265
266// RenderTemplateBytes is a shortcut and renders template bytes directly.
267func (set *TemplateSet) RenderTemplateBytes(b []byte, ctx Context) (string, error) {

Callers

nothing calls this directly

Calls 4

FromStringMethod · 0.95
MustFunction · 0.85
ExecuteMethod · 0.65

Tested by

no test coverage detected