| 69 | } |
| 70 | |
| 71 | func (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. |
| 89 | func (r HTML) Render(w http.ResponseWriter) error { |