package taobaoitem2rst
import (
"html/template"
"net/http"
)
type TemplateValue struct {
Textarea string
}
var index = `
Taobao Item to Rst
HTML to reStructuredText
URL to reStructuredText
`
var tmpl = template.Must(template.New("taobaoitem2rst").Parse(index))
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
val := TemplateValue{}
if r.Method == "POST" {
val.Textarea = getTaobaoItemImgRst(r.PostFormValue("url"), r)
}
if err := tmpl.Execute(w, &val); err != nil {
panic(err)
}
}