forked from NYANDEV/forgejo
6913053223
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.
33 lines
921 B
Go HTML Template
33 lines
921 B
Go HTML Template
{{if false}}
|
|
{{/* to make html structure "likely" complete to prevent IDE warnings */}}
|
|
<html>
|
|
<body>
|
|
<div>
|
|
{{end}}
|
|
|
|
{{template "custom/body_inner_post" .}}
|
|
|
|
</div>
|
|
|
|
{{template "custom/body_outer_post" .}}
|
|
|
|
{{template "base/footer_content" .}}
|
|
|
|
<!-- Third-party libraries -->
|
|
{{if .EnableCaptcha}}
|
|
{{if eq .CaptchaType "recaptcha"}}
|
|
<script src='{{URLJoin .RecaptchaURL "api.js"}}'></script>
|
|
{{end}}
|
|
{{if eq .CaptchaType "hcaptcha"}}
|
|
<script src='https://hcaptcha.com/1/api.js'></script>
|
|
{{end}}
|
|
{{if eq .CaptchaType "cfturnstile"}}
|
|
<script src='https://challenges.cloudflare.com/turnstile/v0/api.js'></script>
|
|
{{end}}
|
|
{{end}}
|
|
<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
|
|
|
|
{{template "custom/footer" .}}
|
|
{{ctx.DataRaceCheck $.Context}}
|
|
</body>
|
|
</html>
|