Skip to content

Commit 647b264

Browse files
authored
Make sure fmt catches all templates (go-gitea#20979)
* Make sure fmt catches all templates Make's `wildcard` is not recursive so it missed many template files, fix that by using `find`. * Update Makefile
1 parent c80ca94 commit 647b264

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+251
-251
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ clean:
243243
.PHONY: fmt
244244
fmt:
245245
@MISSPELL_PACKAGE=$(MISSPELL_PACKAGE) GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
246-
$(eval TEMPLATES := $(wildcard templates/**/*.tmpl))
246+
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
247247
@# strip whitespace after '{{' and before `}}` unless there is only whitespace before it
248248
@$(SED_INPLACE) -e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES)
249249

templates/admin/auth/edit.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<!-- LDAP and DLDAP -->
2525
{{if or .Source.IsLDAP .Source.IsDLDAP}}
26-
{{ $cfg:=.Source.Cfg }}
26+
{{$cfg:=.Source.Cfg}}
2727
<div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
2828
<label>{{.locale.Tr "admin.auths.security_protocol"}}</label>
2929
<div class="ui selection security-protocol dropdown">
@@ -180,7 +180,7 @@
180180

181181
<!-- SMTP -->
182182
{{if .Source.IsSMTP}}
183-
{{ $cfg:=.Source.Cfg }}
183+
{{$cfg:=.Source.Cfg}}
184184
<div class="inline required field">
185185
<label>{{.locale.Tr "admin.auths.smtp_auth"}}</label>
186186
<div class="ui selection type dropdown">
@@ -242,7 +242,7 @@
242242

243243
<!-- PAM -->
244244
{{if .Source.IsPAM}}
245-
{{ $cfg:=.Source.Cfg }}
245+
{{$cfg:=.Source.Cfg}}
246246
<div class="required field">
247247
<label for="pam_service_name">{{.locale.Tr "admin.auths.pam_service_name"}}</label>
248248
<input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required>
@@ -262,7 +262,7 @@
262262

263263
<!-- OAuth2 -->
264264
{{if .Source.IsOAuth2}}
265-
{{ $cfg:=.Source.Cfg }}
265+
{{$cfg:=.Source.Cfg}}
266266
<div class="inline required field">
267267
<label>{{.locale.Tr "admin.auths.oauth2_provider"}}</label>
268268
<div class="ui selection type dropdown">
@@ -337,7 +337,7 @@
337337

338338
<div class="field">
339339
<label for="oauth2_scopes">{{.locale.Tr "admin.auths.oauth2_scopes"}}</label>
340-
<input id="oauth2_scopes" name="oauth2_scopes" value="{{if $cfg.Scopes}}{{Join $cfg.Scopes "," }}{{end}}">
340+
<input id="oauth2_scopes" name="oauth2_scopes" value="{{if $cfg.Scopes}}{{Join $cfg.Scopes ","}}{{end}}">
341341
</div>
342342
<div class="field">
343343
<label for="oauth2_required_claim_name">{{.locale.Tr "admin.auths.oauth2_required_claim_name"}}</label>
@@ -365,7 +365,7 @@
365365

366366
<!-- SSPI -->
367367
{{if .Source.IsSSPI}}
368-
{{ $cfg:=.Source.Cfg }}
368+
{{$cfg:=.Source.Cfg}}
369369
<div class="field">
370370
<div class="ui checkbox">
371371
<label for="sspi_auto_create_users"><strong>{{.locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label>

templates/admin/auth/new.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
</div>
3131

3232
<!-- LDAP and DLDAP -->
33-
{{ template "admin/auth/source/ldap" . }}
33+
{{template "admin/auth/source/ldap" .}}
3434

3535
<!-- SMTP -->
36-
{{ template "admin/auth/source/smtp" . }}
36+
{{template "admin/auth/source/smtp" .}}
3737

3838
<!-- PAM -->
3939
<div class="pam required field {{if not (eq .type 4)}}hide{{end}}">
@@ -51,10 +51,10 @@
5151
</div>
5252

5353
<!-- OAuth2 -->
54-
{{ template "admin/auth/source/oauth" . }}
54+
{{template "admin/auth/source/oauth" .}}
5555

5656
<!-- SSPI -->
57-
{{ template "admin/auth/source/sspi" . }}
57+
{{template "admin/auth/source/sspi" .}}
5858

5959
<div class="ldap field">
6060
<div class="ui checkbox">

templates/admin/user/edit.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{{.CsrfTokenHtml}}
1313
<div class="field {{if .Err_UserName}}error{{end}}">
1414
<label for="user_name">{{.locale.Tr "username"}}</label>
15-
<input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal }}disabled{{end}}>
15+
<input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal}}disabled{{end}}>
1616
</div>
1717
<!-- Types and name -->
1818
<div class="inline required field {{if .Err_LoginType}}error{{end}}">

templates/admin/user/new.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
<div class="inline field local{{if ne .login_type "0-0"}} hide{{end}}">
7171
<div class="ui checkbox">
72-
<label><strong>{{.locale.Tr "auth.allow_password_change" }}</strong></label>
72+
<label><strong>{{.locale.Tr "auth.allow_password_change"}}</strong></label>
7373
<input name="must_change_password" type="checkbox" checked>
7474
</div>
7575
</div>

templates/mail/auth/activate.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>{{.locale.Tr "mail.activate_account.title" (.DisplayName|DotEscape)}}</title>
77
</head>
88

9-
{{ $activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
9+
{{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
1010
<body>
1111
<p>{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}</p><br>
1212
<p>{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>

templates/mail/auth/activate_email.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>{{.locale.Tr "mail.activate_email.title" (.DisplayName|DotEscape)}}</title>
77
</head>
88

9-
{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
9+
{{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
1010
<body>
1111
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
1212
<p>{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>

templates/mail/auth/reset_passwd.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>{{.locale.Tr "mail.reset_password.title" (.DisplayName|DotEscape)}}</title>
77
</head>
88

9-
{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
9+
{{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
1010
<body>
1111
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
1212
<p>{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>

templates/org/member/members.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{template "base/alert" .}}
66

77
<div class="list">
8-
{{ range .Members}}
8+
{{range .Members}}
99
<div class="item ui grid">
1010
<div class="ui four wide column" style="display: flex;">
1111
{{avatar . 48}}
@@ -19,7 +19,7 @@
1919
{{$.locale.Tr "org.members.membership_visibility"}}
2020
</div>
2121
<div class="meta">
22-
{{ $isPublic := index $.MembersIsPublicMember .ID}}
22+
{{$isPublic := index $.MembersIsPublicMember .ID}}
2323
{{if $isPublic}}
2424
<strong>{{$.locale.Tr "org.members.public"}}</strong>
2525
{{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}(<a class="link-action" href data-url="{{$.OrgLink}}/members/action/private?uid={{.ID}}">{{$.locale.Tr "org.members.public_helper"}}</a>){{end}}

templates/package/shared/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{{svg "octicon-package" 32}}
5151
<h2>{{.locale.Tr "packages.empty"}}</h2>
5252
{{if and .Repository .CanWritePackages}}
53-
{{$packagesUrl := URLJoin .Owner.HTMLURL "-" "packages" }}
53+
{{$packagesUrl := URLJoin .Owner.HTMLURL "-" "packages"}}
5454
<p>{{.locale.Tr "packages.empty.repo" $packagesUrl | Safe}}</p>
5555
{{end}}
5656
<p>{{.locale.Tr "packages.empty.documentation" | Safe}}</p>

0 commit comments

Comments
 (0)