0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-30 03:40:08 +01:00
gitea/modules/templates
wxiaoguang 6913053223
Start using template context function (#26254)
Before:

* `{{.locale.Tr ...}}`
* `{{$.locale.Tr ...}}`
* `{{$.root.locale.Tr ...}}`
* `{{template "sub" .}}`
* `{{template "sub" (dict "locale" $.locale)}}`
* `{{template "sub" (dict "root" $)}}`
* .....

With context function: only need to `{{ctx.Locale.Tr ...}}`

The "ctx" could be considered as a super-global variable for all
templates including sub-templates.


To avoid potential risks (any bug in the template context function
package), this PR only starts using "ctx" in "head.tmpl" and
"footer.tmpl" and it has a "DataRaceCheck". If there is anything wrong,
the code can be fixed or reverted easily.
2023-08-08 01:22:47 +00:00
..
eval
scopedtmpl
vars
base.go
dynamic.go
helper_test.go
helper.go
htmlrenderer_test.go
htmlrenderer.go Start using template context function (#26254) 2023-08-08 01:22:47 +00:00
mailer.go
static.go
templates_bindata.go
util_avatar.go
util_dict.go
util_json.go
util_misc.go
util_render_test.go
util_render.go
util_slice.go
util_string.go
util_test.go