From 5699c497a45e08e9e502974e8055d1291dde29dd Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 7 Mar 2025 21:18:28 +0800 Subject: 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 +++--- 14 files changed, 196 insertions(+), 197 deletions(-) diff --git a/templates/_group_path.tmpl b/templates/_group_path.tmpl index f8b5f47..3a14edc 100644 --- a/templates/_group_path.tmpl +++ b/templates/_group_path.tmpl @@ -3,6 +3,6 @@ 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 b914cf9..dbfbe07 100644 --- a/templates/_group_view.tmpl +++ b/templates/_group_view.tmpl @@ -3,7 +3,7 @@ SPDX-FileContributor: Runxi Yu */}} {{- define "group_view" -}} -{{ if .subgroups }} +{{- if .subgroups -}} @@ -15,20 +15,20 @@ - {{- range .subgroups }} + {{- range .subgroups -}} - {{- end }} + {{- end -}}
- {{ .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 0100b7d..6a20f55 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 0042e0f..c0f43d4 100644 --- a/templates/group.tmpl +++ b/templates/group.tmpl @@ -3,24 +3,23 @@ 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 8d787c9..3bef7b0 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -6,11 +6,11 @@ - {{ 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 -}}
- {{ .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 b31cb36..47c4fc4 100644 --- a/templates/login.tmpl +++ b/templates/login.tmpl @@ -6,11 +6,11 @@ - {{ 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 bdb8c24..962b736 100644 --- a/templates/repo_commit.tmpl +++ b/templates/repo_commit.tmpl @@ -6,11 +6,11 @@ - {{ 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 a50a300..81fdb1a 100644 --- a/templates/repo_contrib_index.tmpl +++ b/templates/repo_contrib_index.tmpl @@ -6,11 +6,11 @@ - {{ 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 -}}
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 88bc2fc..cb53558 100644 --- a/templates/repo_contrib_one.tmpl +++ b/templates/repo_contrib_one.tmpl @@ -6,11 +6,11 @@ - {{ 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 c9d7311..4eb0345 100644 --- a/templates/repo_index.tmpl +++ b/templates/repo_index.tmpl @@ -6,11 +6,11 @@ - {{ 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)
Title
{{ .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 -}}
Mode
{{ .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 dbe764e..324ceeb 100644 --- a/templates/repo_log.tmpl +++ b/templates/repo_log.tmpl @@ -6,16 +6,16 @@ - {{ 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 -}}
ID
{{ .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 924df0f..f1461b3 100644 --- a/templates/repo_raw_dir.tmpl +++ b/templates/repo_raw_dir.tmpl @@ -6,17 +6,17 @@ - {{ 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 -}}
{{ .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 a62139c..12d1636 100644 --- a/templates/repo_tree_dir.tmpl +++ b/templates/repo_tree_dir.tmpl @@ -6,17 +6,17 @@ - {{ 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 333e1dc..b0ce0f1 100644 --- a/templates/repo_tree_file.tmpl +++ b/templates/repo_tree_file.tmpl @@ -6,20 +6,20 @@ - {{ 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 -}}
-- cgit v1.2.3