fix #163
you can set the delimiter like this
beego.TemplateLeft="{#"
beego.TemplateRight="#}"
or can set the config file like app.ini
templateleft={#
templateright=#}
Showing
3 changed files
with
11 additions
and
1 deletions
| ... | @@ -48,6 +48,8 @@ var ( | ... | @@ -48,6 +48,8 @@ var ( |
| 48 | EnableXSRF bool | 48 | EnableXSRF bool |
| 49 | XSRFExpire int | 49 | XSRFExpire int |
| 50 | CopyRequestBody bool //When in raw application, You want to the reqeustbody | 50 | CopyRequestBody bool //When in raw application, You want to the reqeustbody |
| 51 | TemplatLeft string | ||
| 52 | TemplatRight string | ||
| 51 | ) | 53 | ) |
| 52 | 54 | ||
| 53 | func init() { | 55 | func init() { |
| ... | @@ -78,6 +80,8 @@ func init() { | ... | @@ -78,6 +80,8 @@ func init() { |
| 78 | ErrorsShow = true | 80 | ErrorsShow = true |
| 79 | XSRFKEY = "beegoxsrf" | 81 | XSRFKEY = "beegoxsrf" |
| 80 | XSRFExpire = 60 | 82 | XSRFExpire = 60 |
| 83 | TemplatLeft = "{{" | ||
| 84 | TemplatRight = "}}" | ||
| 81 | ParseConfig() | 85 | ParseConfig() |
| 82 | runtime.GOMAXPROCS(runtime.NumCPU()) | 86 | runtime.GOMAXPROCS(runtime.NumCPU()) |
| 83 | } | 87 | } | ... | ... |
| ... | @@ -198,6 +198,12 @@ func ParseConfig() (err error) { | ... | @@ -198,6 +198,12 @@ func ParseConfig() (err error) { |
| 198 | if expire, err := AppConfig.Int("xsrfexpire"); err == nil { | 198 | if expire, err := AppConfig.Int("xsrfexpire"); err == nil { |
| 199 | XSRFExpire = expire | 199 | XSRFExpire = expire |
| 200 | } | 200 | } |
| 201 | if tplleft := AppConfig.String("templateleft"); tplleft != "" { | ||
| 202 | TemplatLeft = tplleft | ||
| 203 | } | ||
| 204 | if tplright := AppConfig.String("templateright"); tplright != "" { | ||
| 205 | TemplatRight = tplright | ||
| 206 | } | ||
| 201 | } | 207 | } |
| 202 | return nil | 208 | return nil |
| 203 | } | 209 | } | ... | ... |
| ... | @@ -112,7 +112,7 @@ func BuildTemplate(dir string) error { | ... | @@ -112,7 +112,7 @@ func BuildTemplate(dir string) error { |
| 112 | return err | 112 | return err |
| 113 | } | 113 | } |
| 114 | for k, v := range self.files { | 114 | for k, v := range self.files { |
| 115 | BeeTemplates[k] = template.Must(template.New("beegoTemplate" + k).Funcs(beegoTplFuncMap).ParseFiles(v...)) | 115 | BeeTemplates[k] = template.Must(template.New("beegoTemplate"+k).Funcs(beegoTplFuncMap).ParseFiles(v...)).Delims(TemplatLeft, TemplatRight) |
| 116 | } | 116 | } |
| 117 | return nil | 117 | return nil |
| 118 | } | 118 | } | ... | ... |
-
Please register or sign in to post a comment