Documentation
¶
Overview ¶
Package jinja renders minijinja templates: the format-string engine behind every bar module's format key (minijinja 2 with its builtins and default settings).
It covers what a format string can use: {{ }} expressions with the full operator set, attribute and item access, slicing, filters and tests, if/elif/else, for loops with the loop variable, set, raw blocks, comments, and whitespace control. Macros, includes, and template inheritance are not supported.
Values are Go data: nil (none), bool, the integer and float kinds, string, slices, and string-keyed maps. Undefined is its own value: it prints as nothing, is falsy, and iterates as empty, and looking an attribute up on it is an error, minijinja's lenient behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Undefined any = undefined{}
Undefined is the undefined value.
Functions ¶
func Render ¶
Render renders src with ctx's top-level keys as variables (a map, or nil for none): minijinja's render_str with the default environment.
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env holds the global functions a template may call; the zero value has the builtins only.
func (*Env) AddFunction ¶
AddFunction registers a global function (env.add_function).