1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

Add a 'ParseTemplate' method on view engines to manually parse and add a template from a text

examples at: https://github.com/kataras/iris/tree/master/_examples/view/parse-template

relative to: https://github.com/kataras/iris/issues/1617
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-08 07:55:33 +03:00
parent 64038b09e3
commit a4996b90c8
13 changed files with 307 additions and 100 deletions

View File

@@ -10,13 +10,13 @@ func main() {
app.Logger().SetLevel("debug")
// Init the handlebars engine
engine := iris.Handlebars("./templates", ".html").Reload(true)
e := iris.Handlebars("./templates", ".html").Reload(true)
// Register a helper.
engine.AddFunc("fullName", func(person map[string]string) string {
e.AddFunc("fullName", func(person map[string]string) string {
return person["firstName"] + " " + person["lastName"]
})
app.RegisterView(engine)
app.RegisterView(e)
app.Get("/", func(ctx iris.Context) {
viewData := iris.Map{