Skip to content

Commit a319da0

Browse files
authored
Replace whitespace inside template parens during make fmt (#24293)
Remove space/tab after `(` and before `)` in templates. Only two violations it seems.
1 parent cc88748 commit a319da0

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,12 @@ clean:
278278
fmt:
279279
GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
280280
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
281-
@# strip whitespace after '{{' and before `}}` unless there is only whitespace before it
282-
@$(SED_INPLACE) -e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES)
281+
@# strip whitespace after '{{' or '(' and before '}}' or ')' unless there is only
282+
@# whitespace before it
283+
@$(SED_INPLACE) \
284+
-e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' \
285+
-e 's/([ ]\{1,\}/(/g' -e '/^[ ]\{1,\})/! s/[ ]\{1,\})/)/g' \
286+
$(TEMPLATES)
283287

284288
.PHONY: fmt-check
285289
fmt-check: fmt

templates/repo/issue/labels/label_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
{{end}}
4343
</div>
4444
<div class="three wide column">
45-
{{if and (not $.PageIsOrgSettingsLabels ) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
45+
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
4646
<a class="ui right delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
4747
<a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a>
4848
{{else if $.PageIsOrgSettingsLabels}}

templates/repo/settings/collaboration.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<h4 class="ui top attached header">
5353
{{$.locale.Tr "repo.settings.teams"}}
5454
</h4>
55-
{{$allowedToChangeTeams := ( or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}}
55+
{{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}}
5656
{{if .Teams}}
5757
<div class="ui attached segment collaborator list">
5858
{{range $t, $team := .Teams}}

0 commit comments

Comments
 (0)