Versions in this module Expand all Collapse all v1 v1.5.4 Aug 10, 2023 Changes in this version + var TypeDict = reflect.TypeOf(Dict{}) + func CaseInsensitive(data sort.Interface) sort.Interface + func Self(r *Renderer) map[string]func() string + type Context struct + func EmptyContext() *Context + func NewContext(data map[string]interface{}) *Context + func (ctx *Context) Get(name string) (interface{}, bool) + func (ctx *Context) Has(name string) bool + func (ctx *Context) Inherit() *Context + func (ctx *Context) Merge(other *Context) *Context + func (ctx *Context) Set(name string, value interface{}) + func (ctx *Context) Update(other map[string]interface{}) *Context + type Dict struct + Pairs []*Pair + func NewDict() *Dict + func (d *Dict) Get(key *Value) *Value + func (d *Dict) Keys() ValuesList + func (d *Dict) String() string + type EvalConfig struct + Filters *FilterSet + Globals *Context + Loader TemplateLoader + Statements *StatementSet + Tests *TestSet + func NewEvalConfig(cfg *config.Config) *EvalConfig + func (cfg *EvalConfig) GetTemplate(filename string) (*nodes.Template, error) + func (cfg *EvalConfig) Inherit() *EvalConfig + type Evaluator struct + Ctx *Context + func (e *Evaluator) Eval(node nodes.Expression) *Value + func (e *Evaluator) EvalTest(expr *nodes.TestExpression) *Value + func (e *Evaluator) EvaluateFiltered(expr *nodes.FilteredExpression) *Value + func (e *Evaluator) ExecuteFilter(fc *nodes.FilterCall, v *Value) *Value + func (e *Evaluator) ExecuteFilterByName(name string, in *Value, params *VarArgs) *Value + func (e *Evaluator) ExecuteTest(tc *nodes.TestCall, v *Value) *Value + func (e *Evaluator) ExecuteTestByName(name string, in *Value, params *VarArgs) *Value + type FilterFunction func(e *Evaluator, in *Value, params *VarArgs) *Value + type FilterSet map[string]FilterFunction + func (fs *FilterSet) Register(name string, fn FilterFunction) error + func (fs *FilterSet) Replace(name string, fn FilterFunction) error + func (fs *FilterSet) Update(other FilterSet) FilterSet + func (fs FilterSet) Exists(name string) bool + type KwArg struct + Default interface{} + Name string + type Macro func(params *VarArgs) *Value + func MacroNodeToFunc(node *nodes.Macro, r *Renderer) (Macro, error) + type MacroSet map[string]Macro + func (ms *MacroSet) Register(name string, fn Macro) error + func (ms *MacroSet) Replace(name string, fn Macro) error + func (ms MacroSet) Exists(name string) bool + type Pair struct + Key *Value + Value *Value + func (p *Pair) String() string + type ReducedVarArgs struct + func (rva *ReducedVarArgs) Error() string + func (rva *ReducedVarArgs) IsError() bool + type Renderer struct + Ctx *Context + Out *strings.Builder + Root *nodes.Template + Template *Template + func NewRenderer(ctx *Context, out *strings.Builder, cfg *EvalConfig, tpl *Template) *Renderer + func (r *Renderer) Eval(node nodes.Expression) *Value + func (r *Renderer) Evaluator() *Evaluator + func (r *Renderer) Execute() error + func (r *Renderer) ExecuteWrapper(wrapper *nodes.Wrapper) error + func (r *Renderer) Inherit() *Renderer + func (r *Renderer) String() string + func (r *Renderer) Visit(node nodes.Node) (nodes.Visitor, error) + type Statement interface + Execute func(*Renderer, *nodes.StatementBlock) error + type StatementSet map[string]parser.StatementParser + func (ss *StatementSet) Register(name string, parser parser.StatementParser) error + func (ss *StatementSet) Replace(name string, parser parser.StatementParser) error + func (ss *StatementSet) Update(other StatementSet) StatementSet + func (ss StatementSet) Exists(name string) bool + type Template struct + Env *EvalConfig + Loader TemplateLoader + Macros MacroSet + Name string + Parser *parser.Parser + Reader io.Reader + Root *nodes.Template + Source string + Tokens *tokens.Stream + func NewTemplate(name string, source string, cfg *EvalConfig) (*Template, error) + func (tpl *Template) Execute(ctx map[string]interface{}) (string, error) + func (tpl *Template) ExecuteBytes(ctx map[string]interface{}) ([]byte, error) + type TemplateLoader interface + GetTemplate func(string) (*Template, error) + Path func(string) (string, error) + type TestFunction func(*Context, *Value, *VarArgs) (bool, error) + type TestSet map[string]TestFunction + func (ts *TestSet) Register(name string, fn TestFunction) error + func (ts *TestSet) Replace(name string, fn TestFunction) error + func (ts *TestSet) Update(other TestSet) TestSet + func (ts TestSet) Exists(name string) bool + type Value struct + Safe bool + Val reflect.Value + func AsSafeValue(i interface{}) *Value + func AsValue(i interface{}) *Value + func ToValue(data interface{}) *Value + func ValueError(err error) *Value + func (v *Value) Bool() bool + func (v *Value) CanSlice() bool + func (v *Value) Contains(other *Value) bool + func (v *Value) EqualValueTo(other *Value) bool + func (v *Value) Error() string + func (v *Value) Escaped() string + func (v *Value) Float() float64 + func (v *Value) Get(key string) (*Value, bool) + func (v *Value) Getattr(name string) (*Value, bool) + func (v *Value) Getitem(key interface{}) (*Value, bool) + func (v *Value) Index(i int) *Value + func (v *Value) Integer() int + func (v *Value) Interface() interface{} + func (v *Value) IsBool() bool + func (v *Value) IsCallable() bool + func (v *Value) IsDict() bool + func (v *Value) IsError() bool + func (v *Value) IsFloat() bool + func (v *Value) IsInteger() bool + func (v *Value) IsIterable() bool + func (v *Value) IsList() bool + func (v *Value) IsNil() bool + func (v *Value) IsNumber() bool + func (v *Value) IsString() bool + func (v *Value) IsTrue() bool + func (v *Value) Items() []*Pair + func (v *Value) Iterate(fn func(idx, count int, key, value *Value) bool, empty func()) + func (v *Value) IterateOrder(fn func(idx, count int, key, value *Value) bool, empty func(), reverse bool, ...) + func (v *Value) Keys() ValuesList + func (v *Value) Len() int + func (v *Value) Negate() *Value + func (v *Value) Set(key *Value, value interface{}) error + func (v *Value) Slice(i, j int) *Value + func (v *Value) String() string + func (v *Value) ToGoSimpleType(allowInterfaceKeys bool) interface{} + type ValuesList []*Value + func (vl ValuesList) Contains(value *Value) bool + func (vl ValuesList) Len() int + func (vl ValuesList) Less(i, j int) bool + func (vl ValuesList) String() string + func (vl ValuesList) Swap(i, j int) + type VarArgs struct + Args []*Value + KwArgs map[string]*Value + func NewVarArgs() *VarArgs + func (va *VarArgs) Expect(args int, kwargs []*KwArg) *ReducedVarArgs + func (va *VarArgs) ExpectArgs(args int) *ReducedVarArgs + func (va *VarArgs) ExpectKwArgs(kwargs []*KwArg) *ReducedVarArgs + func (va *VarArgs) ExpectNothing() *ReducedVarArgs + func (va *VarArgs) First() *Value + func (va *VarArgs) GetKwarg(key string, fallback interface{}) *Value