upgrade gin to v1.2 (#245)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
19
vendor/github.com/gin-gonic/gin/render/html.go
generated
vendored
19
vendor/github.com/gin-gonic/gin/render/html.go
generated
vendored
@@ -10,17 +10,25 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
Delims struct {
|
||||
Left string
|
||||
Right string
|
||||
}
|
||||
|
||||
HTMLRender interface {
|
||||
Instance(string, interface{}) Render
|
||||
}
|
||||
|
||||
HTMLProduction struct {
|
||||
Template *template.Template
|
||||
Delims Delims
|
||||
}
|
||||
|
||||
HTMLDebug struct {
|
||||
Files []string
|
||||
Glob string
|
||||
Files []string
|
||||
Glob string
|
||||
Delims Delims
|
||||
FuncMap template.FuncMap
|
||||
}
|
||||
|
||||
HTML struct {
|
||||
@@ -48,11 +56,14 @@ func (r HTMLDebug) Instance(name string, data interface{}) Render {
|
||||
}
|
||||
}
|
||||
func (r HTMLDebug) loadTemplate() *template.Template {
|
||||
if r.FuncMap == nil {
|
||||
r.FuncMap = template.FuncMap{}
|
||||
}
|
||||
if len(r.Files) > 0 {
|
||||
return template.Must(template.ParseFiles(r.Files...))
|
||||
return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseFiles(r.Files...))
|
||||
}
|
||||
if len(r.Glob) > 0 {
|
||||
return template.Must(template.ParseGlob(r.Glob))
|
||||
return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseGlob(r.Glob))
|
||||
}
|
||||
panic("the HTML debug render was created without files or glob pattern")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user