Skip to content

Commit

Permalink
Merge pull request #300 from ip75/fix_engine_struct
Browse files Browse the repository at this point in the history
fix implementation of IEngineCore functions in Engine struct
  • Loading branch information
ReneWerner87 authored Sep 29, 2023
2 parents a65418d + d23025d commit 7ca689d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type Engine struct {

// AddFunc adds the function to the template's function map.
// It is legal to overwrite elements of the default actions
func (e *Engine) AddFunc(name string, fn interface{}) *Engine {
func (e *Engine) AddFunc(name string, fn interface{}) IEngineCore {
e.Mutex.Lock()
e.Funcmap[name] = fn
e.Mutex.Unlock()
Expand All @@ -61,7 +61,7 @@ func (e *Engine) AddFunc(name string, fn interface{}) *Engine {

// AddFuncMap adds the functions from a map to the template's function map.
// It is legal to overwrite elements of the default actions
func (e *Engine) AddFuncMap(m map[string]interface{}) *Engine {
func (e *Engine) AddFuncMap(m map[string]interface{}) IEngineCore {
e.Mutex.Lock()
for name, fn := range m {
e.Funcmap[name] = fn
Expand All @@ -71,15 +71,15 @@ func (e *Engine) AddFuncMap(m map[string]interface{}) *Engine {
}

// Debug will print the parsed templates when Load is triggered.
func (e *Engine) Debug(enabled bool) *Engine {
func (e *Engine) Debug(enabled bool) IEngineCore {
e.Verbose = enabled
return e
}

// Delims sets the action delimiters to the specified strings, to be used in
// templates. An empty delimiter stands for the
// corresponding default: "{{" and "}}".
func (e *Engine) Delims(left, right string) *Engine {
func (e *Engine) Delims(left, right string) IEngineCore {
e.Left, e.Right = left, right
return e
}
Expand All @@ -90,15 +90,15 @@ func (e *Engine) FuncMap() map[string]interface{} {
}

// Layout defines the variable name that will incapsulate the template
func (e *Engine) Layout(key string) *Engine {
func (e *Engine) Layout(key string) IEngineCore {
e.LayoutName = key
return e
}

// Reload if set to true the templates are reloading on each render,
// use it when you're in development and you don't want to restart
// the application when you edit a template file.
func (e *Engine) Reload(enabled bool) *Engine {
func (e *Engine) Reload(enabled bool) IEngineCore {
e.ShouldReload = enabled
return e
}

0 comments on commit 7ca689d

Please sign in to comment.