From 5699c497a45e08e9e502974e8055d1291dde29dd Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 07 Mar 2025 21:18:28 +0800 Subject: [PATCH] http/templates: Reduce whitespace --- templates/_group_path.tmpl | 6 +++--- templates/_group_view.tmpl | 24 ++++++++++++------------ templates/_header.tmpl | 10 +++++----- templates/group.tmpl | 25 ++++++++++++------------- templates/index.tmpl | 20 ++++++++++---------- templates/login.tmpl | 8 ++++---- templates/repo_commit.tmpl | 64 +++++++++++++++++++++++++++--------------------------- templates/repo_contrib_index.tmpl | 18 +++++++++--------- templates/repo_contrib_one.tmpl | 62 +++++++++++++++++++++++++++--------------------------- templates/repo_index.tmpl | 66 +++++++++++++++++++++++++++--------------------------- templates/repo_log.tmpl | 22 +++++++++++----------- templates/repo_raw_dir.tmpl | 26 +++++++++++++------------- templates/repo_tree_dir.tmpl | 32 ++++++++++++++++---------------- templates/repo_tree_file.tmpl | 10 +++++----- diff --git a/templates/_group_path.tmpl b/templates/_group_path.tmpl index f8b5f47dfc7febe49134b95d9c8c003d7fafe42e..3a14edc0fd4a97149a4759c82ca1d837347263fe 100644 --- a/templates/_group_path.tmpl +++ b/templates/_group_path.tmpl @@ -3,6 +3,6 @@ SPDX-License-Identifier: AGPL-3.0-only SPDX-FileContributor: Runxi Yu */}} {{- define "group_path_plain" -}} -{{ $p := . }} -{{ range $i, $s := . }}{{ $s }}{{ if ne $i (len $p) }}/{{ end }}{{ end }} -{{ end }} +{{- $p := . -}} +{{- range $i, $s := . -}}{{- $s -}}{{- if ne $i (len $p) -}}/{{- end -}}{{- end -}} +{{- end -}} diff --git a/templates/_group_view.tmpl b/templates/_group_view.tmpl index b914cf92813dd753e73a5da08be96c5ce4af6bf2..dbfbe07139b37a6fd1e432606c8f0f66b10c1087 100644 --- a/templates/_group_view.tmpl +++ b/templates/_group_view.tmpl @@ -3,7 +3,7 @@ SPDX-License-Identifier: AGPL-3.0-only SPDX-FileContributor: Runxi Yu */}} {{- define "group_view" -}} -{{ if .subgroups }} +{{- if .subgroups -}} @@ -15,20 +15,20 @@ - {{- range .subgroups }} + {{- range .subgroups -}} - {{- end }} + {{- end -}}
Description
- {{ .Name }} + {{- .Name -}} - {{ .Description }} + {{- .Description -}}
-{{ end }} -{{ if .repos }} +{{- end -}} +{{- if .repos -}} @@ -40,17 +40,17 @@ - {{- range .repos }} + {{- range .repos -}} - {{- end }} + {{- end -}}
- {{ .Name }} + {{- .Name -}} - {{ .Description }} + {{- .Description -}}
-{{ end }} +{{- end -}} {{- end -}} diff --git a/templates/_header.tmpl b/templates/_header.tmpl index 0100b7dd9d892be28d73d4f282be22688481fc02..6a20f557658c5d3e63e014c6ceae8a95019bfd7c 100644 --- a/templates/_header.tmpl +++ b/templates/_header.tmpl @@ -5,14 +5,14 @@ */}} {{- define "header" -}}
- {{ if ne .user_id_string "" }} - {{ .username }} - {{ else }} + {{- if ne .user_id_string "" -}} + {{- .username -}} + {{- else -}} Login - {{ end }} + {{- end -}}
{{- end -}} diff --git a/templates/group.tmpl b/templates/group.tmpl index 0042e0f067a7aec845f3bedb6c0cb9f51ee115ce..c0f43d49d69828f4ebe1672167a24eb5ba3e2d88 100644 --- a/templates/group.tmpl +++ b/templates/group.tmpl @@ -3,24 +3,23 @@ SPDX-License-Identifier: AGPL-3.0-only SPDX-FileContributor: Runxi Yu */}} {{- define "group" -}} -{{ $group_path := .group_path }} +{{- $group_path := .group_path -}} - {{ template "head_common" . }} - {{ range $i, $s := .group_path }}{{ $s }}{{ if ne $i (len $group_path) }} / {{ end }}{{ end }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + {{- range $i, $s := .group_path -}}{{- $s -}}{{- if ne $i (len $group_path) -}}/{{- end -}}{{- end }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
-

{{ range $i, $s := .group_path }}{{ $s }}{{ if ne $i (len $group_path) }} / {{ end }}{{ end }} - {{ if .description }} -

{{ .description }}

- {{ end }} - - {{ template "group_view" . }} +

{{- range $i, $s := .group_path -}}{{- $s -}}{{- if ne $i (len $group_path) }} / {{ end -}}{{- end -}} + {{- if .description -}} +

{{- .description -}}

+ {{- end -}} + {{- template "group_view" . -}}
- {{ if .direct_access }} + {{- if .direct_access -}}
@@ -73,9 +72,9 @@
- {{ end }} + {{- end -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/index.tmpl b/templates/index.tmpl index 8d787c943817055a16ce067e9ac4ac34224aa224..3bef7b06191ad2c60a9f652977fe16e40b42e68b 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -6,11 +6,11 @@ {{- define "index" -}} - {{ template "head_common" . }} - Index – {{ .global.forge_title }} + {{- template "head_common" . -}} + Index – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -23,16 +23,16 @@ - {{- range .groups }} + {{- range .groups -}} - {{- end }} + {{- end -}}
Description
- {{ .Name }} + {{- .Name -}} - {{ .Description }} + {{- .Description -}}
@@ -47,17 +47,17 @@ SSH public key - {{ .global.server_public_key_string }} + {{- .global.server_public_key_string -}} SSH fingerprint - {{ .global.server_public_key_fingerprint }} + {{- .global.server_public_key_fingerprint -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/login.tmpl b/templates/login.tmpl index b31cb36ed9d6b37515d23a05f0095fee97d31419..47c4fc403b867eba3bad795c9486c79489f3600c 100644 --- a/templates/login.tmpl +++ b/templates/login.tmpl @@ -6,11 +6,11 @@ {{- define "login" -}} - {{ template "head_common" . }} - Login – {{ .global.forge_title }} + {{- template "head_common" . -}} + Login – {{ .global.forge_title -}} - {{ .login_error }} + {{- .login_error -}}
@@ -52,7 +52,7 @@
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_commit.tmpl b/templates/repo_commit.tmpl index bdb8c24f51376a20a215909df08a6425d0c65d96..962b7360d244d829594849036af5b756a998b05a 100644 --- a/templates/repo_commit.tmpl +++ b/templates/repo_commit.tmpl @@ -6,11 +6,11 @@ {{- define "repo_commit" -}} - {{ template "head_common" . }} - Commit {{ .commit_id }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + Commit {{ .commit_id }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -21,73 +21,73 @@ - + - + - + - + - + - +
ID{{ .commit_id }}{{- .commit_id -}}
Author{{ .commit_object.Author.Name }} <{{ .commit_object.Author.Email }}>{{- .commit_object.Author.Name -}} <{{- .commit_object.Author.Email -}}>
Author date{{ .commit_object.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}{{- .commit_object.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
Committer{{ .commit_object.Committer.Name }} <{{ .commit_object.Committer.Email }}>{{- .commit_object.Committer.Name -}} <{{- .commit_object.Committer.Email -}}>
Committer date{{ .commit_object.Committer.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}{{- .commit_object.Committer.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
Actions
Get patch
Get patch
-
{{ .commit_object.Message }}
+
{{- .commit_object.Message -}}
- {{ $parent_commit_hash := .parent_commit_hash }} - {{ $commit_object := .commit_object }} - {{ range .file_patches }} + {{- $parent_commit_hash := .parent_commit_hash -}} + {{- $commit_object := .commit_object -}} + {{- range .file_patches -}}
- -
- {{ end }} + {{- end -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_contrib_index.tmpl b/templates/repo_contrib_index.tmpl index a50a300102d867b5cf75168d5bd934dba9761dee..81fdb1a50f9bc92f7240ce5425106b19e36abf72 100644 --- a/templates/repo_contrib_index.tmpl +++ b/templates/repo_contrib_index.tmpl @@ -6,11 +6,11 @@ {{- define "repo_contrib_index" -}} - {{ template "head_common" . }} - Merge requests – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + Merge requests – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -24,18 +24,18 @@ - {{- range .merge_requests }} + {{- range .merge_requests -}} - - - + + + - {{- end }} + {{- end -}}
Description Status
{{ .ID }}{{ .Title }}{{ .Status }}{{- .ID -}}{{- .Title -}}{{- .Status -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_contrib_one.tmpl b/templates/repo_contrib_one.tmpl index 88bc2fc50e2b728b63fa44bbd75979206d2f5d9f..cb5355881aba3b11925fdd54fac07ee8d5329f73 100644 --- a/templates/repo_contrib_one.tmpl +++ b/templates/repo_contrib_one.tmpl @@ -6,11 +6,11 @@ {{- define "repo_contrib_one" -}} - {{ template "head_common" . }} - Merge requests – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + Merge requests – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -21,70 +21,70 @@ - + - + - + - + - + - +
ID{{ .mr_id }}{{- .mr_id -}}
Status{{ .mr_status }}{{- .mr_status -}}
Title{{ .mr_title }}{{- .mr_title -}}
Source ref{{ .mr_source_ref }}{{- .mr_source_ref -}}
Destination branch{{ .mr_destination_branch }}{{- .mr_destination_branch -}}
Merge base{{ .merge_base.ID.String }}{{- .merge_base.ID.String -}}
- {{ $merge_base := .merge_base }} - {{ $source_commit := .source_commit }} - {{ range .file_patches }} + {{- $merge_base := .merge_base -}} + {{- $source_commit := .source_commit -}} + {{- range .file_patches -}}
- -
- {{ end }} + {{- end -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_index.tmpl b/templates/repo_index.tmpl index c9d7311074e2dc4515315cf42a3f8ca4538b20c1..4eb0345e136858937d7e497dead148d182d4a356 100644 --- a/templates/repo_index.tmpl +++ b/templates/repo_index.tmpl @@ -6,11 +6,11 @@ {{- define "repo_index" -}} - {{ template "head_common" . }} - {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -21,24 +21,24 @@ - + - {{ if .repo_description }} + {{- if .repo_description -}} - + - {{ end }} + {{- end -}} - + - {{ if .notes }} + {{- if .notes -}} - + - {{ end }} + {{- end -}}
Name{{ .repo_name }}{{- .repo_name -}}
Description{{ .repo_description }}{{- .repo_description -}}
SSH remote{{ .ssh_clone_url }}{{- .ssh_clone_url -}}
Notes
    {{ range .notes }}
  • {{ . }}
  • {{ end }}
    {{- range .notes -}}
  • {{- . -}}
  • {{- end -}}
@@ -47,12 +47,12 @@

Merge requests

- {{ if .commits }} + {{- if .commits -}}
- + @@ -61,27 +61,27 @@ - {{- range .commits }} + {{- range .commits -}} - + - {{- end }} + {{- end -}}
Recent commits (see all)Recent commits (see all)
TitleAuthor Date
{{ .Message | first_line }}{{- .Message | first_line -}} - + - {{ .Author.When.Format "2006-01-02 15:04:05 -0700" }} + {{- .Author.When.Format "2006-01-02 15:04:05 -0700" -}}
- {{ end }} - {{ if .files }} + {{- end -}} + {{- if .files -}}
- + @@ -90,26 +90,26 @@ - {{- $ref_type := .ref_type }} - {{- $ref := .ref_name }} - {{- range .files }} + {{- $ref_type := .ref_type -}} + {{- $ref := .ref_name -}} + {{- range .files -}} - - - + + + - {{- end }} + {{- end -}}
/{{ if .ref_name }} on {{ .ref_name }}{{ end }}/{{- if .ref_name -}} on {{- .ref_name -}}{{- end -}}
ModeSize
{{ .Mode }}{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ .Size }}{{- .Mode -}}{{- .Name -}}{{- if not .Is_file -}}/{{- end -}}{{- .Size -}}
- {{ end }} - {{ if .readme }} + {{- end -}} + {{- if .readme -}}
- {{ .readme }} + {{- .readme -}}
- {{ end }} + {{- end -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_log.tmpl b/templates/repo_log.tmpl index dbe764e75d79f4fad4031935c553fa4b9d8a6578..324ceeb67d1e60e56828d6b6c7e14590a174afaf 100644 --- a/templates/repo_log.tmpl +++ b/templates/repo_log.tmpl @@ -6,16 +6,16 @@ {{- define "repo_log" -}} - {{ template "head_common" . }} - Log – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + Log – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
- + @@ -25,23 +25,23 @@ - {{- range .commits }} + {{- range .commits -}} - - + + - {{- end }} + {{- end -}}
Commits {{ if .ref_name }} on {{ .ref_name }}{{ end }}Commits {{ if .ref_name }} on {{ .ref_name }}{{ end -}}
IDTime
{{ .ID }}{{ .Message | first_line }}{{- .ID -}}{{- .Message | first_line -}} - + - {{ .Author.When.Format "2006-01-02 15:04:05 -0700" }} + {{- .Author.When.Format "2006-01-02 15:04:05 -0700" -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_raw_dir.tmpl b/templates/repo_raw_dir.tmpl index 924df0f76c04633334d9139f567316968215e623..f1461b3191f794751e2a31496b87ebf0cbe08768 100644 --- a/templates/repo_raw_dir.tmpl +++ b/templates/repo_raw_dir.tmpl @@ -6,17 +6,17 @@ {{- define "repo_raw_dir" -}} - {{ template "head_common" . }} - /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -26,16 +26,16 @@ - {{- $path_spec := .path_spec }} - {{- $ref := .ref_name }} - {{- $ref_type := .ref_type }} - {{- range .files }} + {{- $path_spec := .path_spec -}} + {{- $ref := .ref_name -}} + {{- $ref_type := .ref_type -}} + {{- range .files -}} - - - + + + - {{- end }} + {{- end -}}
- (Raw) /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref_name }} on {{ .ref_name }}{{ end }} + (Raw) /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref_name }} on {{ .ref_name }}{{ end -}}
Size
{{ .Mode }}{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ .Size }}{{- .Mode -}}{{- .Name -}}{{- if not .Is_file -}}/{{- end -}}{{- .Size -}}
@@ -44,7 +44,7 @@
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_tree_dir.tmpl b/templates/repo_tree_dir.tmpl index a62139caa6234a22162fd2d237957a3123404883..12d1636cb72083d977e1e555b0c92c3f2c54f62c 100644 --- a/templates/repo_tree_dir.tmpl +++ b/templates/repo_tree_dir.tmpl @@ -6,17 +6,17 @@ {{- define "repo_tree_dir" -}} - {{ template "head_common" . }} - /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + {{- template "head_common" . -}} + /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}
@@ -26,16 +26,16 @@ - {{- $path_spec := .path_spec }} - {{- $ref := .ref_name }} - {{- $ref_type := .ref_type }} - {{- range .files }} + {{- $path_spec := .path_spec -}} + {{- $ref := .ref_name -}} + {{- $ref_type := .ref_type -}} + {{- range .files -}} - - - + + + - {{- end }} + {{- end -}}
- /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref_name }} on {{ .ref_name }}{{ end }} + /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref_name }} on {{ .ref_name }}{{ end -}}
Mode
{{ .Mode }}{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ .Size }}{{- .Mode -}}{{- .Name -}}{{- if not .Is_file -}}/{{- end -}}{{- .Size -}}
@@ -43,13 +43,13 @@
- {{ if .readme }} + {{- if .readme -}}
- {{ .readme -}} + {{- .readme -}}
- {{ end }} + {{- end -}}
- {{ template "footer" . }} + {{- template "footer" . -}}
diff --git a/templates/repo_tree_file.tmpl b/templates/repo_tree_file.tmpl index 333e1dc11a4d010694d1b6db8c9f5b51ee9dd4aa..b0ce0f1ad3bca6450ce095dda71410bbfa72fac2 100644 --- a/templates/repo_tree_file.tmpl +++ b/templates/repo_tree_file.tmpl @@ -6,20 +6,20 @@ {{- define "repo_tree_file" -}} - {{ template "head_common" . }} + {{- template "head_common" . -}} - /{{ .path_spec }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title }} + /{{ .path_spec }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} - {{ template "header" . }} + {{- template "header" . -}}

/{{ .path_spec }} (raw)

- {{ .file_contents }} + {{- .file_contents -}}
-- 2.48.1