Beispiel #1
0
// @modified by henry, 2016.1.12
func (engine *Engine) LoadHTMLFiles(files ...string) {
	if IsDebugging() {
		engine.HTMLRender = render.HTMLDebug{Files: files}
	} else {
		templ := template.Must(template.Must(render.HTMLTemplate.Clone()).ParseFiles(files...))
		engine.SetHTMLTemplate(templ)
	}
}
Beispiel #2
0
// @modified by henry, 2016.1.12
func (engine *Engine) LoadHTMLGlob(pattern string) {
	templ := template.Must(template.Must(render.HTMLTemplate.Clone()).ParseGlob(pattern))
	if IsDebugging() {
		debugPrintLoadTemplate(templ)
		engine.HTMLRender = render.HTMLDebug{Glob: pattern}
	} else {
		engine.SetHTMLTemplate(templ)
	}
}
Beispiel #3
0
// @modified by henry, 2016.1.12
func (r HTMLDebug) loadTemplate() *template.Template {
	if len(r.Files) > 0 {
		return template.Must(template.Must(HTMLTemplate.Clone()).ParseFiles(r.Files...))
	}
	if len(r.Glob) > 0 {
		return template.Must(template.Must(HTMLTemplate.Clone()).ParseGlob(r.Glob))
	}
	panic("the HTML debug render was created without files or glob pattern")
}