diff --git a/beego.go b/beego.go index 5d3a8109..113b2255 100644 --- a/beego.go +++ b/beego.go @@ -48,6 +48,8 @@ var ( EnableXSRF bool XSRFExpire int CopyRequestBody bool //When in raw application, You want to the reqeustbody + TemplatLeft string + TemplatRight string ) func init() { @@ -78,6 +80,8 @@ func init() { ErrorsShow = true XSRFKEY = "beegoxsrf" XSRFExpire = 60 + TemplatLeft = "{{" + TemplatRight = "}}" ParseConfig() runtime.GOMAXPROCS(runtime.NumCPU()) } diff --git a/config.go b/config.go index 116c66b9..bcdf0316 100644 --- a/config.go +++ b/config.go @@ -198,6 +198,12 @@ func ParseConfig() (err error) { if expire, err := AppConfig.Int("xsrfexpire"); err == nil { XSRFExpire = expire } + if tplleft := AppConfig.String("templateleft"); tplleft != "" { + TemplatLeft = tplleft + } + if tplright := AppConfig.String("templateright"); tplright != "" { + TemplatRight = tplright + } } return nil } diff --git a/template.go b/template.go index 0feffbe3..328f241e 100644 --- a/template.go +++ b/template.go @@ -112,7 +112,7 @@ func BuildTemplate(dir string) error { return err } for k, v := range self.files { - BeeTemplates[k] = template.Must(template.New("beegoTemplate" + k).Funcs(beegoTplFuncMap).ParseFiles(v...)) + BeeTemplates[k] = template.Must(template.New("beegoTemplate"+k).Funcs(beegoTplFuncMap).ParseFiles(v...)).Delims(TemplatLeft, TemplatRight) } return nil }