blob: 3668a66f5c2413385eb2afec0b131e3387caf91a [file] [log] [blame]
package main
import (
"html/template"
"log"
"os"
)
type Foo struct{ Bar string }
func main() {
tmpl, err := template.New("home").Parse(`
<a title={{.Bar | html}}>
`)
if err != nil {
log.Fatalf("could not parse: %v", err)
}
foo := Foo{"haha onclick=evil()"}
if err := tmpl.Execute(os.Stdout, foo); err != nil {
log.Fatalf("could not execute: %v", err)
}
}