Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
Created October 8, 2013 10:42
Show Gist options
  • Save JakubOboza/6882844 to your computer and use it in GitHub Desktop.
Save JakubOboza/6882844 to your computer and use it in GitHub Desktop.
package main
import(
"fmt"
"github.com/hoisie/mustache"
"bytes"
)
func main(){
data := map[string]string{"c":"world", "some":"<br />lol<br />"}
rendered_template := mustache.Render("<a href=\"http://google.com\">google</a>hello {{c}} and some {{some}}", data)
fmt.Printf("render result: '%s'\n", rendered_template)
tmpl,_ := mustache.ParseString("hello {{c}}")
var buf bytes.Buffer;
for i := 0; i < 10; i++ {
tmpl.Render (map[string]string { "c":"world"}, &buf)
}
rendered_in_layout := mustache.RenderInLayout("<a href=\"http://google.com\">google</a>hello {{c}} and some {{some}}", "<html>{{{content}}}</html>", data)
fmt.Printf("In layout '%s'\n", rendered_in_layout)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment