aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-12-10 16:07:02 +0100
committerSimon Ser <contact@emersion.fr>2019-12-10 16:07:02 +0100
commit4a504b0fc6d76afa52fbdafde338182c8463f6a0 (patch)
treecae529e3582ef6987682497011e72b694da97a58
parent95da47f7c4522247b7136d14a923d54be5c1a9ae (diff)
downloadalps-4a504b0fc6d76afa52fbdafde338182c8463f6a0.tar.gz
alps-4a504b0fc6d76afa52fbdafde338182c8463f6a0.zip
Rename Plugin.Render to Plugin.Inject
This function doesn't render anything, it just adds extra data to the template data.
-rw-r--r--plugin.go2
-rw-r--r--plugin_lua.go2
-rw-r--r--template.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/plugin.go b/plugin.go
index 6a5b7e7..03e2261 100644
--- a/plugin.go
+++ b/plugin.go
@@ -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
}
diff --git a/plugin_lua.go b/plugin_lua.go
index c1a8ebe..a0eecef 100644
--- a/plugin_lua.go
+++ b/plugin_lua.go
@@ -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
diff --git a/template.go b/template.go
index 2cce5a3..b7af212 100644
--- a/template.go
+++ b/template.go
@@ -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)
}
}