1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-21 10:56:01 +00:00

version 12.1.5

Former-commit-id: cda69f08955cb0d594e98bf26197ee573cbba4b2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-02-02 16:29:06 +02:00
parent e04ea83c04
commit 3093d65363
76 changed files with 9647 additions and 366 deletions

View File

@@ -10,7 +10,6 @@ import (
"path/filepath"
"strings"
"sync"
"time"
)
// HTMLEngine contains the html view engine structure.
@@ -71,8 +70,8 @@ func HTML(directory, extension string) *HTMLEngine {
left: "{{",
right: "}}",
layout: "",
layoutFuncs: make(map[string]interface{}, 0),
funcs: make(map[string]interface{}, 0),
layoutFuncs: make(map[string]interface{}),
funcs: make(map[string]interface{}),
}
return s
@@ -244,7 +243,7 @@ func (s *HTMLEngine) loadDirectory() error {
s.Templates = template.New(dir)
s.Templates.Delims(s.left, s.right)
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if info == nil || info.IsDir() {
} else {
rel, err := filepath.Rel(dir, path)
@@ -288,6 +287,10 @@ func (s *HTMLEngine) loadDirectory() error {
return nil
})
if err != nil {
return err
}
return templateErr
}
@@ -374,7 +377,10 @@ func (s *HTMLEngine) loadAssets() error {
}
// Add our funcmaps.
tmpl.Funcs(emptyFuncs).Funcs(s.funcs).Parse(contents)
if _, err = tmpl.Funcs(emptyFuncs).Funcs(s.funcs).Parse(contents); err != nil {
templateErr = err
continue
}
}
}
return templateErr
@@ -455,8 +461,6 @@ func (s *HTMLEngine) runtimeFuncsFor(name string, binding interface{}) {
}
}
var zero = time.Time{}
// ExecuteWriter executes a template and writes its result to the w writer.
func (s *HTMLEngine) ExecuteWriter(w io.Writer, name string, layout string, bindingData interface{}) error {
// re-parse the templates if reload is enabled.