aboutsummaryrefslogtreecommitdiff
path: root/edit.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-02-17 07:54:30 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-02-17 07:54:30 +0100
commit45c9fdd5279e926c629c4e4fe3fd81b61c9c40dd (patch)
treebe3ddff8cd249a89779bac38c73a060d52f0e0b7 /edit.go
parenta57064fa2a6c8c5ca41713dbc9541f0cca4cfe27 (diff)
Parse template once
Diffstat (limited to 'edit.go')
-rw-r--r--edit.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/edit.go b/edit.go
index a425a1a..3a4ca37 100644
--- a/edit.go
+++ b/edit.go
@@ -9,8 +9,10 @@ func init() {
http.HandleFunc("/edit/", editHandler)
}
+var edittmpl = template.Must(template.ParseFiles("tmpl/root", "tmpl/edit"))
+
func editHandler(w http.ResponseWriter, r *http.Request) {
title := r.URL.Path[len("/edit/"):]
p, _ := loadPage(title)
- p.render(w, template.Must(template.ParseFiles("tmpl/root", "tmpl/edit")))
+ p.render(w, edittmpl)
}