示例#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
文件: layouts.go 项目: kobeld/duoerl
func ProduceLayout(name string) Middleware {
	return mangotemplate.MakeLayout(GetTemplate(), name, &MangoTemplateProvider{})
}