Skip to content

Commit

Permalink
Update readme with new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hoisie committed Aug 24, 2010
1 parent 44547fa commit 3c13035
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ Also check out some [example mustache files](http://github.com/defunkt/mustache/

There are only four methods in this package:

func Render(data string, context interface{}) (string, os.Error)
func Render(data string, context ...interface{}) string

func RenderFile(filename string, context interface{}) (string, os.Error)
func RenderFile(filename string, context ...interface{}) string

func ParseString(data string) (*template, os.Error)

func ParseFile(filename string) (*template, os.Error)


The Render method takes a string and a data source, which is generally a map or struct. There's an analagous method, RenderFile, which takes a filename as an argument and uses that for the template contents.
The Render method takes a string and a data source, which is generally a map or struct, and returns the output string. If the template file contains an error, the return value is a description of the error. There's a similar method, RenderFile, which takes a filename as an argument and uses that for the template contents.

data,_ := mustache.Render("hello {{c}}", map[string]string{"c":"world"})
data := mustache.Render("hello {{c}}", map[string]string{"c":"world"})
println(data)


Expand Down

0 comments on commit 3c13035

Please sign in to comment.