Skip to content

Instantly share code, notes, and snippets.

@gregworley
Created February 6, 2013 20:54
Show Gist options
  • Save gregworley/4725728 to your computer and use it in GitHub Desktop.
Save gregworley/4725728 to your computer and use it in GitHub Desktop.
trying to use gorilla template with slots and fills
package main
import (
template "github.com/gorilla/template/v0"
"fmt"
"os"
)
func main() {
set, err := new(template.Set).Parse(`{{define "slot"}}
{{slot "header"}}
{{template "slot_header"}}
{{end}}
{{slot "content"}}
slot content
{{end}}
{{slot "footer"}}
slot footer
{{end}}
{{end}}
{{define "slot_header"}}
a header
{{end}}
{{define "page1"}}
{{fill "slot"}}
{{slot "header"}}
{{template "slot_header"}}
page1 header
{{end}}
{{slot "content"}}
page1 content
{{end}}
{{end}}
{{end}}`)
if err != nil {
fmt.Print(err)
}
err = set.Execute(os.Stderr, "page1", nil)
if err != nil {
fmt.Print(err)
}
}
@gregworley
Copy link
Author

This isn't outputting anything for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment