Skip to content

Commit f171dd0

Browse files
committed
Add whitespace removal around inside template curly brackes
1 parent 3d12018 commit f171dd0

30 files changed

+109
-102
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ clean:
242242

243243
.PHONY: fmt
244244
fmt:
245-
@echo "Running gitea-fmt (with gofumpt)..."
246245
@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))
247+
@$(SED_INPLACE) -e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES)
247248

248249
.PHONY: vet
249250
vet:
@@ -288,13 +289,19 @@ errcheck:
288289

289290
.PHONY: fmt-check
290291
fmt-check:
291-
# get all go files and run gitea-fmt (with gofmt) on them
292+
@# get all go files and run gitea-fmt (with gofmt) on them
292293
@diff=$$(MISSPELL_PACKAGE=$(MISSPELL_PACKAGE) GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -l '{file-list}'); \
293294
if [ -n "$$diff" ]; then \
294295
echo "Please run 'make fmt' and commit the result:"; \
295296
echo "$${diff}"; \
296297
exit 1; \
297298
fi
299+
@diff2=$$(git diff templates); \
300+
if [ -n "$$diff2" ]; then \
301+
echo "Please run 'make fmt' and commit the result:"; \
302+
echo "$${diff2}"; \
303+
exit 1; \
304+
fi
298305

299306
.PHONY: checks
300307
checks: checks-frontend checks-backend

templates/admin/config.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<dt>{{.locale.Tr "admin.config.reverse_auth_user"}}</dt>
5151
<dd>{{.ReverseProxyAuthUser}}</dd>
5252

53-
{{if .EnvVars }}
53+
{{if .EnvVars}}
5454
<div class="ui divider"></div>
5555
{{range .EnvVars}}
5656
<dt>{{.Name}}</dt>

templates/admin/cron.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
<td>{{$.locale.Tr (printf "admin.dashboard.%s" .Name)}}</td>
2323
<td>{{.Spec}}</td>
2424
<td>{{DateFmtLong .Next}}</td>
25-
<td>{{if gt .Prev.Year 1 }}{{DateFmtLong .Prev}}{{else}}N/A{{end}}</td>
25+
<td>{{if gt .Prev.Year 1}}{{DateFmtLong .Prev}}{{else}}N/A{{end}}</td>
2626
<td>{{.ExecTimes}}</td>
27-
<td {{if ne .Status ""}}class="tooltip" data-content="{{.FormatLastMessage $.locale}}"{{end}} >{{if eq .Status "" }}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td>
27+
<td {{if ne .Status ""}}class="tooltip" data-content="{{.FormatLastMessage $.locale}}"{{end}} >{{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td>
2828
</tr>
2929
{{end}}
3030
</tbody>

templates/admin/notice.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</tr>
3535
{{end}}
3636
</tbody>
37-
{{ if .Notices }}
37+
{{if .Notices}}
3838
<tfoot class="full-width">
3939
<tr>
4040
<th></th>
@@ -65,11 +65,11 @@
6565
</th>
6666
</tr>
6767
</tfoot>
68-
{{ end }}
68+
{{end}}
6969
</table>
7070
</div>
7171

72-
{{ template "base/paginate" . }}
72+
{{template "base/paginate" .}}
7373
</div>
7474
</div>
7575

templates/admin/process-row.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="item">
22
<div class="df ac">
3-
<div class="icon ml-3 mr-3">{{if eq .Process.Type "request"}}{{svg "octicon-globe" 16 }}{{else if eq .Process.Type "system"}}{{svg "octicon-cpu" 16 }}{{else}}{{svg "octicon-terminal" 16 }}{{end}}</div>
3+
<div class="icon ml-3 mr-3">{{if eq .Process.Type "request"}}{{svg "octicon-globe" 16}}{{else if eq .Process.Type "system"}}{{svg "octicon-cpu" 16}}{{else}}{{svg "octicon-terminal" 16}}{{end}}</div>
44
<div class="content f1">
55
<div class="header">{{.Process.Description}}</div>
66
<div class="description"><span title="{{DateFmtLong .Process.Start}}">{{TimeSince .Process.Start .root.locale}}</span></div>

templates/admin/queue.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
</tbody>
3131
</table>
3232
</div>
33-
{{if lt $sum 0 }}
33+
{{if lt $sum 0}}
3434
<h4 class="ui top attached header">
3535
{{.locale.Tr "admin.monitor.queue.nopool.title"}}
3636
</h4>
3737
<div class="ui attached segment">
38-
{{if eq .Queue.Type "wrapped" }}
38+
{{if eq .Queue.Type "wrapped"}}
3939
<p>{{.locale.Tr "admin.monitor.queue.wrapped.desc"}}</p>
4040
{{else if eq .Queue.Type "persistable-channel"}}
4141
<p>{{.locale.Tr "admin.monitor.queue.persistable-channel.desc"}}</p>
@@ -58,7 +58,7 @@
5858
</div>
5959
<div class="inline field">
6060
<label for="timeout">{{.locale.Tr "admin.monitor.queue.settings.timeout"}}</label>
61-
<input name="timeout" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.settings.timeout.placeholder" .Queue.BoostTimeout }}">
61+
<input name="timeout" type="text" placeholder="{{.locale.Tr "admin.monitor.queue.settings.timeout.placeholder" .Queue.BoostTimeout}}">
6262
</div>
6363
<div class="inline field">
6464
<label for="number">{{.locale.Tr "admin.monitor.queue.settings.numberworkers"}}</label>
@@ -166,7 +166,7 @@
166166
</tr>
167167
{{else}}
168168
<tr>
169-
<td colspan="4">{{.locale.Tr "admin.monitor.queue.pool.workers.none" }}
169+
<td colspan="4">{{.locale.Tr "admin.monitor.queue.pool.workers.none"}}
170170
</tr>
171171
{{end}}
172172
</tbody>

templates/admin/stacktrace-row.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
<div class="df ac">
33
<div class="icon ml-3 mr-3">
44
{{if eq .Process.Type "request"}}
5-
{{svg "octicon-globe" 16 }}
5+
{{svg "octicon-globe" 16}}
66
{{else if eq .Process.Type "system"}}
7-
{{svg "octicon-cpu" 16 }}
7+
{{svg "octicon-cpu" 16}}
88
{{else if eq .Process.Type "normal"}}
9-
{{svg "octicon-terminal" 16 }}
9+
{{svg "octicon-terminal" 16}}
1010
{{else}}
11-
{{svg "octicon-code" 16 }}
11+
{{svg "octicon-code" 16}}
1212
{{end}}
1313
</div>
1414
<div class="content f1">
1515
<div class="header">{{.Process.Description}}</div>
1616
<div class="description">{{if ne .Process.Type "none"}}<span title="{{DateFmtLong .Process.Start}}">{{TimeSince .Process.Start .root.locale}}</span>{{end}}</div>
1717
</div>
1818
<div>
19-
{{if or (eq .Process.Type "request") (eq .Process.Type "normal") }}
19+
{{if or (eq .Process.Type "request") (eq .Process.Type "normal")}}
2020
<a class="delete-button icon" href="" data-url="{{.root.Link}}/cancel/{{.Process.PID}}" data-id="{{.Process.PID}}" data-name="{{.Process.Description}}">{{svg "octicon-trash" 16 "text-red"}}</a>
2121
{{end}}
2222
</div>
@@ -29,7 +29,7 @@
2929
<summary>
3030
<div class="dif content">
3131
<div class="header ml-3">
32-
<span class="icon mr-3">{{svg "octicon-code" 16 }}</span>{{.Description}}{{if gt .Count 1}} * {{.Count}}{{end}}
32+
<span class="icon mr-3">{{svg "octicon-code" 16}}</span>{{.Description}}{{if gt .Count 1}} * {{.Count}}{{end}}
3333
</div>
3434
<div class="description">
3535
{{range .Labels}}
@@ -41,7 +41,7 @@
4141
<div class="list">
4242
{{range .Entry}}
4343
<div class="item df ac">
44-
<span class="icon mr-4">{{svg "octicon-dot-fill" 16 }}</span>
44+
<span class="icon mr-4">{{svg "octicon-dot-fill" 16}}</span>
4545
<div class="content f1">
4646
<div class="header"><code>{{.Function}}</code></div>
4747
<div class="description"><code>{{.File}}:{{.Line}}</code></div>

templates/base/footer.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<!-- Third-party libraries -->
1717
{{if .EnableCaptcha}}
1818
{{if eq .CaptchaType "recaptcha"}}
19-
<script src='{{ URLJoin .RecaptchaURL "api.js"}}' async></script>
19+
<script src='{{URLJoin .RecaptchaURL "api.js"}}' async></script>
2020
{{end}}
2121
{{if eq .CaptchaType "hcaptcha"}}
2222
<script src='https://hcaptcha.com/1/api.js' async></script>

templates/base/head.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
<meta property="og:description" content="{{MetaDescription}}">
6666
{{end}}
6767
<meta property="og:site_name" content="{{AppName}}">
68-
{{if .IsSigned }}
69-
{{ if ne .SignedUser.Theme "gitea" }}
68+
{{if .IsSigned}}
69+
{{if ne .SignedUser.Theme "gitea"}}
7070
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{.SignedUser.Theme | PathEscape}}.css?v={{MD5 AppVer}}">
7171
{{end}}
7272
{{else if ne DefaultTheme "gitea"}}

templates/base/head_script.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
2020
enableTimeTracking: {{EnableTimetracking}},
2121
{{if .RequireTribute}}
2222
tributeValues: Array.from(new Map([
23-
{{ range .Participants }}
23+
{{range .Participants}}
2424
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
2525
name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
26-
{{ end }}
27-
{{ range .Assignees }}
26+
{{end}}
27+
{{range .Assignees}}
2828
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
2929
name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
30-
{{ end }}
31-
{{ range .MentionableTeams }}
30+
{{end}}
31+
{{range .MentionableTeams}}
3232
['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}',
3333
name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}],
34-
{{ end }}
34+
{{end}}
3535
]).values()),
3636
{{end}}
3737
mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},

0 commit comments

Comments
 (0)