aboutsummaryrefslogtreecommitdiff
path: root/plugins/lua
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-05-13 14:07:44 +0200
committerSimon Ser <contact@emersion.fr>2020-05-13 14:07:44 +0200
commitb891a95fcf4a3d4b64100911dae49fb28904a7fd (patch)
treefe07b29d6f2443047b7f740c79d86b3c499cc9e9 /plugins/lua
parent4cf5ad68afd80f27512c464843b0d917182ef0c2 (diff)
downloadalps-b891a95fcf4a3d4b64100911dae49fb28904a7fd.tar.gz
alps-b891a95fcf4a3d4b64100911dae49fb28904a7fd.zip
Rename project to alps
Diffstat (limited to 'plugins/lua')
-rw-r--r--plugins/lua/lua.go18
-rw-r--r--plugins/lua/plugin.go6
2 files changed, 12 insertions, 12 deletions
diff --git a/plugins/lua/lua.go b/plugins/lua/lua.go
index d236702..451c884 100644
--- a/plugins/lua/lua.go
+++ b/plugins/lua/lua.go
@@ -1,11 +1,11 @@
-package koushinlua
+package alpslua
import (
"fmt"
"html/template"
"path/filepath"
- "git.sr.ht/~emersion/koushin"
+ "git.sr.ht/~emersion/alps"
"github.com/labstack/echo/v4"
"github.com/yuin/gopher-lua"
"layeh.com/gopher-luar"
@@ -69,7 +69,7 @@ func (p *luaPlugin) setRoute(l *lua.LState) int {
return 0
}
-func (p *luaPlugin) inject(name string, data koushin.RenderData) error {
+func (p *luaPlugin) inject(name string, data alps.RenderData) error {
f, ok := p.renderCallbacks[name]
if !ok {
return nil
@@ -87,7 +87,7 @@ func (p *luaPlugin) inject(name string, data koushin.RenderData) error {
return nil
}
-func (p *luaPlugin) Inject(ctx *koushin.Context, name string, data koushin.RenderData) error {
+func (p *luaPlugin) Inject(ctx *alps.Context, name string, data alps.RenderData) error {
if err := p.inject("*", data); err != nil {
return err
}
@@ -144,8 +144,8 @@ func loadLuaPlugin(filename string) (*luaPlugin, error) {
filters: make(template.FuncMap),
}
- mt := l.NewTypeMetatable("koushin")
- l.SetGlobal("koushin", mt)
+ mt := l.NewTypeMetatable("alps")
+ l.SetGlobal("alps", mt)
l.SetField(mt, "on_render", l.NewFunction(p.onRender))
l.SetField(mt, "set_filter", l.NewFunction(p.setFilter))
l.SetField(mt, "set_route", l.NewFunction(p.setRoute))
@@ -158,15 +158,15 @@ func loadLuaPlugin(filename string) (*luaPlugin, error) {
return p, nil
}
-func loadAllLuaPlugins(s *koushin.Server) ([]koushin.Plugin, error) {
+func loadAllLuaPlugins(s *alps.Server) ([]alps.Plugin, error) {
log := s.Logger()
- filenames, err := filepath.Glob(koushin.PluginDir + "/*/main.lua")
+ filenames, err := filepath.Glob(alps.PluginDir + "/*/main.lua")
if err != nil {
return nil, fmt.Errorf("filepath.Glob failed: %v", err)
}
- plugins := make([]koushin.Plugin, 0, len(filenames))
+ plugins := make([]alps.Plugin, 0, len(filenames))
for _, filename := range filenames {
log.Printf("Loading Lua plugin %q", filename)
diff --git a/plugins/lua/plugin.go b/plugins/lua/plugin.go
index dbfee6d..aaf5597 100644
--- a/plugins/lua/plugin.go
+++ b/plugins/lua/plugin.go
@@ -1,9 +1,9 @@
-package koushinlua
+package alpslua
import (
- "git.sr.ht/~emersion/koushin"
+ "git.sr.ht/~emersion/alps"
)
func init() {
- koushin.RegisterPluginLoader(loadAllLuaPlugins)
+ alps.RegisterPluginLoader(loadAllLuaPlugins)
}