Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yosssi committed Feb 25, 2014
1 parent a7df74a commit 61c5f36
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 61c5f36

Please sign in to comment.