mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:40:55 +00:00
fix #163
you can set the delimiter like this beego.TemplateLeft="{#" beego.TemplateRight="#}" or can set the config file like app.ini templateleft={# templateright=#}
This commit is contained in:
parent
e02f9a9931
commit
4f538e7fd2
4
beego.go
4
beego.go
@ -48,6 +48,8 @@ var (
|
|||||||
EnableXSRF bool
|
EnableXSRF bool
|
||||||
XSRFExpire int
|
XSRFExpire int
|
||||||
CopyRequestBody bool //When in raw application, You want to the reqeustbody
|
CopyRequestBody bool //When in raw application, You want to the reqeustbody
|
||||||
|
TemplatLeft string
|
||||||
|
TemplatRight string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -78,6 +80,8 @@ func init() {
|
|||||||
ErrorsShow = true
|
ErrorsShow = true
|
||||||
XSRFKEY = "beegoxsrf"
|
XSRFKEY = "beegoxsrf"
|
||||||
XSRFExpire = 60
|
XSRFExpire = 60
|
||||||
|
TemplatLeft = "{{"
|
||||||
|
TemplatRight = "}}"
|
||||||
ParseConfig()
|
ParseConfig()
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
}
|
}
|
||||||
|
@ -198,6 +198,12 @@ func ParseConfig() (err error) {
|
|||||||
if expire, err := AppConfig.Int("xsrfexpire"); err == nil {
|
if expire, err := AppConfig.Int("xsrfexpire"); err == nil {
|
||||||
XSRFExpire = expire
|
XSRFExpire = expire
|
||||||
}
|
}
|
||||||
|
if tplleft := AppConfig.String("templateleft"); tplleft != "" {
|
||||||
|
TemplatLeft = tplleft
|
||||||
|
}
|
||||||
|
if tplright := AppConfig.String("templateright"); tplright != "" {
|
||||||
|
TemplatRight = tplright
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func BuildTemplate(dir string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for k, v := range self.files {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user