aboutsummaryrefslogtreecommitdiff
path: root/edit.go
blob: 3a4ca37a88251c16d3a1eac4828d9d0f644415b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package main

import (
	"net/http"
	"text/template"
)

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, edittmpl)
}