Пример #1
0
func LayoutAndRenderer() (l Middleware, r Middleware) {
	tpl, err := template.ParseGlob("templates/*/*.html")
	if err != nil {
		panic(err)
	}
	l = mangotemplate.MakeLayout(tpl, "main", &provider{})
	r = mangotemplate.MakeRenderer(tpl)
	return
}
Пример #2
0
func NewMux() (r *pat.PatternServeMux) {

	tpl, err := template.ParseGlob("templates/*/*.html")
	if err != nil {
		panic(err)
	}

	layout := mangotemplate.MakeLayout(tpl, "main", &provider{})
	renderer := mangotemplate.MakeRenderer(tpl)

	s := new(Stack)
	s.Middleware(layout, renderer)

	m := pat.New()
	m.Get("/", s.HandlerFunc(home.Index))
	return m
}
Пример #3
0
func ProduceLayout(name string) Middleware {
	return mangotemplate.MakeLayout(GetTemplate(), name, &MangoTemplateProvider{})
}