package main import ( "log" "net/http" "text/template" // FIXME switch to html/template for security reasons // and make a workaround for rendered Markdown insertion ) func setupTemplates() *template.Template { t, err := template.ParseGlob(config.Http.Templates + "/*.html") if err != nil { panic(err) } return t } func ServeTemplate(w http.ResponseWriter, name string, data interface{}) { err := templates.ExecuteTemplate(w, name, data) if err != nil { log.Print(err) http.Error(w, http.StatusText(404), 404) return } }