diff --git a/context.go b/context.go index dbc5e3e..a5739a4 100644 --- a/context.go +++ b/context.go @@ -87,7 +87,7 @@ func newExecutionContext(tpl *Template, ctx Context) *ExecutionContext { Public: ctx, Private: privateCtx, - Autoescape: autoescape, + Autoescape: tpl.Options.AutoEscape, } } diff --git a/options.go b/options.go index 9c39e46..e2cd059 100644 --- a/options.go +++ b/options.go @@ -8,12 +8,14 @@ type Options struct { // If this is set to true leading spaces and tabs are stripped from the start of a line to a block. Defaults to false LStripBlocks bool + AutoEscape bool } func newOptions() *Options { return &Options{ TrimBlocks: false, LStripBlocks: false, + AutoEscape: true, } } @@ -21,6 +23,7 @@ func newOptions() *Options { func (opt *Options) Update(other *Options) *Options { opt.TrimBlocks = other.TrimBlocks opt.LStripBlocks = other.LStripBlocks + opt.AutoEscape = other.AutoEscape return opt }