Browse Source

Rename Plugin.Render to Plugin.Inject

This function doesn't render anything, it just adds extra data to the
template data.
master
Simon Ser 4 years ago
parent
commit
4a504b0fc6
No known key found for this signature in database GPG Key ID: FDE7BE0E88F5E48
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      plugin.go
  2. +1
    -1
      plugin_lua.go
  3. +1
    -1
      template.go

+ 1
- 1
plugin.go View File

@@ -10,6 +10,6 @@ type Plugin interface {
Name() string
Filters() template.FuncMap
SetRoutes(group *echo.Group)
Render(name string, data interface{}) error
Inject(name string, data interface{}) error
Close() error
}

+ 1
- 1
plugin_lua.go View File

@@ -68,7 +68,7 @@ func (p *luaPlugin) setRoute(l *lua.LState) int {
return 0
}

func (p *luaPlugin) Render(name string, data interface{}) error {
func (p *luaPlugin) Inject(name string, data interface{}) error {
f, ok := p.renderCallbacks[name]
if !ok {
return nil


+ 1
- 1
template.go View File

@@ -19,7 +19,7 @@ func (t *tmpl) Render(w io.Writer, name string, data interface{}, ectx echo.Cont
ctx := ectx.Get("context").(*context)

for _, plugin := range ctx.server.plugins {
if err := plugin.Render(name, data); err != nil {
if err := plugin.Inject(name, data); err != nil {
return fmt.Errorf("failed to run plugin '%v': %v", plugin.Name(), err)
}
}


Loading…
Cancel
Save