Commit d98507f1 authored by Andrew Gerrand's avatar Andrew Gerrand

doc: update wiki tutorial templates, and template discussion

Fixes #3384.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5915044
parent 7a396541
......@@ -58,17 +58,10 @@ func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
http.Redirect(w, r, "/view/"+title, http.StatusFound)
}
var templates = make(map[string]*template.Template)
func init() {
for _, tmpl := range []string{"edit", "view"} {
t := template.Must(template.ParseFiles(tmpl + ".html"))
templates[tmpl] = t
}
}
var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
err := templates[tmpl].Execute(w, p)
err := templates.ExecuteTemplate(w, tmpl+".html", p)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment