Exemple #1
0
func (h Html) render(htmlstr string, value_map interface{}, buf io.Writer) {
	w := h.w
	if buf == nil {
		// To prevent headers from being sent too early.
		buf = &bytes.Buffer{}
		defer func(buf *bytes.Buffer) {
			io.Copy(w, buf)
			buf.Reset()
		}(buf.(*bytes.Buffer))
	}
	t := html.Must(html.New("html").Funcs(w.HtmlFunc).Parse(htmlstr))
	err := t.Execute(buf, value_map)
	w.Check(err)
}