MCPcopy
hub / github.com/gin-gonic/gin / loadTemplate

Method loadTemplate

render/html.go:71–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71func (r HTMLDebug) loadTemplate() *template.Template {
72 if r.FuncMap == nil {
73 r.FuncMap = template.FuncMap{}
74 }
75 if len(r.Files) > 0 {
76 return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseFiles(r.Files...))
77 }
78 if r.Glob != "" {
79 return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseGlob(r.Glob))
80 }
81 if r.FileSystem != nil && len(r.Patterns) > 0 {
82 return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseFS(
83 fs.FileSystem{FileSystem: r.FileSystem}, r.Patterns...))
84 }
85 panic("the HTML debug render was created without files or glob pattern or file system with patterns")
86}
87
88// Render (HTML) executes template and writes its result with custom ContentType for response.
89func (r HTML) Render(w http.ResponseWriter) error {

Callers 1

InstanceMethod · 0.95

Calls 1

DelimsMethod · 0.80

Tested by

no test coverage detected