Skip to content

Commit

Permalink
Clone Options from TemplateSet.Options
Browse files Browse the repository at this point in the history
  • Loading branch information
SokoloffA committed Jun 2, 2017
1 parent 84719ff commit ada54c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ func newOptions() *Options {
LStripBlocks: false,
}
}

// Update updates this options from another options.
func (opt *Options) Update(other *Options) *Options {
opt.TrimBlocks = other.TrimBlocks
opt.LStripBlocks = other.LStripBlocks

return opt
}
4 changes: 3 additions & 1 deletion template.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ func newTemplate(set *TemplateSet, name string, isTplString bool, tpl []byte) (*
size: len(strTpl),
blocks: make(map[string]*NodeWrapper),
exportedMacros: make(map[string]*tagMacroNode),
Options: set.Options,
Options: newOptions(),
}
// Copy all settings from another Options.
t.Options.Update(set.Options)

// Tokenize it
tokens, err := lex(name, strTpl)
Expand Down

0 comments on commit ada54c0

Please sign in to comment.