diff --git a/render/context.go b/render/context.go index 833af9c..aa365a2 100644 --- a/render/context.go +++ b/render/context.go @@ -14,6 +14,8 @@ import ( // Context provides the rendering context for a tag renderer. type Context interface { + // Bindings returns the current lexical environment. + Bindings() map[string]interface{} // Get retrieves the value of a variable from the current lexical environment. Get(name string) interface{} // Errorf creates a SourceError, that includes the source location. @@ -104,6 +106,11 @@ func (c rendererContext) EvaluateString(source string) (out interface{}, err err return expressions.EvaluateString(source, expressions.NewContext(c.ctx.bindings, c.ctx.config.Config.Config)) } +// Bindings returns the current lexical environment. +func (c rendererContext) Bindings() map[string]interface{} { + return c.ctx.bindings +} + // Get gets a variable value within an evaluation context. func (c rendererContext) Get(name string) interface{} { return c.ctx.bindings[name]