mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-13 17:46:23 -07:00
Add template loading to the templates manage action
This commit is contained in:
parent
a8436c5ee4
commit
7e07e24f16
6 changed files with 87 additions and 55 deletions
|
@ -1,6 +1,9 @@
|
|||
package gctemplates
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"path"
|
||||
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
luar "layeh.com/gopher-luar"
|
||||
)
|
||||
|
@ -14,7 +17,7 @@ func PreloadModule(l *lua.LState) int {
|
|||
for i := 0; i < l.GetTop(); i++ {
|
||||
tmplPaths = append(tmplPaths, l.CheckString(i+1))
|
||||
}
|
||||
tmpl, err := loadTemplate(tmplPaths...)
|
||||
tmpl, err := template.New(path.Base(tmplPaths[0])).Funcs(funcMap).ParseFiles(tmplPaths...)
|
||||
l.Push(luar.New(l, tmpl))
|
||||
l.Push(luar.New(l, err))
|
||||
return 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue