From 61c5f36e5149701f5433f1332cbc801cf45c7b3a Mon Sep 17 00:00:00 2001 From: Keiji Yoshida Date: Tue, 25 Feb 2014 18:59:52 +0900 Subject: [PATCH] Update README.md --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c31213..045547d 100644 --- a/README.md +++ b/README.md @@ -62,15 +62,28 @@ import ( "net/http" ) +// Create a generator which parses a Gold templates and +// returns a html/template package's template. +// You can have a generator cache templates by passing +// true to NewGenerator function. var g = gold.NewGenerator(false) func handler(w http.ResponseWriter, r *http.Request) { + // ParseFile parses a Gold templates and + // returns a html/template package's template. tpl, err := g.ParseFile("./top.gold") + if err != nil { panic(err) } + data := map[string]interface{}{"Title": "Gold"} - if err := tpl.Execute(w, data); err != nil { + + // Call Execute method of the html/template + // package's template. + err := tpl.Execute(w, data) + + if err != nil { panic(err) } }