From 7386392b8cd08e73e4f5fa6080e8f4fcf20831f6 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 27 Jul 2024 08:00:00 +0800 Subject: Some more HTML sanities --- templates/404.html | 8 +- templates/500.html | 4 +- templates/commit.html | 185 +++++++++++++++++++++++---------------------- templates/file.html | 4 +- templates/head.html | 38 +++++----- templates/index.html | 9 +-- templates/log.html | 21 +++-- templates/nav.html | 14 ++-- templates/refs.html | 35 +++++---- templates/repo-header.html | 5 +- templates/repo.html | 36 ++++----- templates/tree.html | 55 ++++++-------- 12 files changed, 199 insertions(+), 215 deletions(-) (limited to 'templates') diff --git a/templates/404.html b/templates/404.html index dd8c813..3a68101 100644 --- a/templates/404.html +++ b/templates/404.html @@ -4,10 +4,10 @@ 404 Not Found {{ template "head" . }} - {{ template "nav" . }} -
-

404 Not Found

-
+ {{ template "nav" . }} +
+

404 Not Found

+
{{ end }} diff --git a/templates/500.html b/templates/500.html index 6217541..77bb9ab 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,12 +1,12 @@ {{ define "500" }} - 500 + 500 Internal Server Error {{ template "head" . }} {{ template "nav" . }}
-

500 — something broke!

+

500 Internal Server Error

diff --git a/templates/commit.html b/templates/commit.html index c592523..c556fa8 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -1,105 +1,106 @@ {{ define "commit" }} -{{ template "head" . }} -{{ template "repoheader" . }} - - {{ template "nav" . }} -
-
-
{{- .commit.Message -}}
-
- {{ .commit.Author.Name }} {{ .commit.Author.Email}} -
{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
-
- -
- commit -

- - {{ .commit.This }} - -

-
- - {{ if .commit.Parent }} -
- parent -

- - {{ .commit.Parent }} - -

-
- {{ end }} - -
-
- {{ .stat.FilesChanged }} files changed, - {{ .stat.Insertions }} insertions(+), - {{ .stat.Deletions }} deletions(-) + {{ template "head" . }} + + {{ template "repoheader" . }} + {{ template "nav" . }} +
+
+
{{- .commit.Message -}}
+
+ {{ .commit.Author.Name }} + {{ .commit.Author.Email }} +
{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
+
-
- jump to - {{ range .diff }} - - {{ end }} + commit +

+ + {{ .commit.This }} + +

+
+ + {{ if .commit.Parent }} + + {{ end }} + +
+
+ {{ .stat.FilesChanged }} files changed, + {{ .stat.Insertions }} insertions(+), + {{ .stat.Deletions }} deletions(-) +
+
+
+ Jump to: + {{ range .diff }} + + {{ end }} +
-
-
-
- {{ $repo := .name }} - {{ $this := .commit.This }} - {{ $parent := .commit.Parent }} - {{ range .diff }} +
+
+ {{ $repo := .name }} + {{ $this := .commit.This }} + {{ $parent := .commit.Parent }} + {{ range .diff }}
- {{ if .IsNew }} - A - {{ end }} - {{ if .IsDelete }} - D - {{ end }} - {{ if not (or .IsNew .IsDelete) }} - M - {{ end }} - {{ if .Name.Old }} - {{ .Name.Old }} - {{ if .Name.New }} - → - {{ .Name.New }} - {{ end }} - {{ else }} - {{ .Name.New }} - {{- end -}} - {{ if .IsBinary }} -

Not showing binary file.

- {{ else }} -
-					{{- range .TextFragments -}}
-					

{{- .Header -}}

- {{- range .Lines -}} - {{- if eq .Op.String "+" -}} - {{ .String }} + {{ if .IsNew }} + A + {{ end }} + {{ if .IsDelete }} + D + {{ end }} + {{ if not (or .IsNew .IsDelete) }} + M + {{ end }} + {{ if .Name.Old }} + {{ .Name.Old }} + {{ if .Name.New }} + → + {{ .Name.New }} + {{ end }} + {{ else }} + {{ .Name.New }} {{- end -}} - {{- if eq .Op.String "-" -}} - {{ .String }} + {{ if .IsBinary }} +

Not showing binary file.

+ {{ else }} +
+							{{- range .TextFragments -}}
+								

{{- .Header -}}

+ {{- range .Lines -}} + {{- if eq .Op.String "+" -}} + {{ .String }} + {{- end -}} + {{- if eq .Op.String "-" -}} + {{ .String }} + {{- end -}} + {{- if eq .Op.String " " -}} + {{ .String }} + {{- end -}} + {{- end -}} + {{- end -}} +
{{- end -}} - {{- if eq .Op.String " " -}} - {{ .String }} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} -
-
+
- {{ end }} -
-
- + {{ end }} + + + {{ end }} diff --git a/templates/file.html b/templates/file.html index 758f68a..7dd5b86 100644 --- a/templates/file.html +++ b/templates/file.html @@ -2,13 +2,13 @@ {{ template "head" . }} - {{ template "repoheader" . }} + {{ template "repoheader" . }} {{ template "nav" . }}

{{ .path }} (view raw)

-
{{- .content -}}
+
{{- .content -}}
diff --git a/templates/head.html b/templates/head.html index b5be55d..f2a3bda 100644 --- a/templates/head.html +++ b/templates/head.html @@ -1,32 +1,30 @@ {{ define "head" }} - - - - - - {{ if .parent }} + + + + + + {{ if .parent }} {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/ - - {{ else if .path }} + {{ else if .path }} {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }} - {{ else if .files }} + {{ else if .files }} {{ .meta.Title }} — {{ .name }} ({{ .ref }}) - {{ else if .commit }} + {{ else if .commit }} {{ .meta.Title }} — {{ .name }}: {{ .commit.This }} - {{ else if .branches }} + {{ else if .branches }} {{ .meta.Title }} — {{ .name }}: refs - {{ else if .commits }} + {{ else if .commits }} {{ if .log }} - {{ .meta.Title }} — {{ .name }}: log + {{ .meta.Title }} — {{ .name }}: log {{ else }} - {{ .meta.Title }} — {{ .name }} + {{ .meta.Title }} — {{ .name }} {{ end }} - {{ else }} + {{ else }} {{ .meta.Title }} - {{ end }} - {{ if and .servername .gomod }} + {{ end }} + {{ if and .servername .gomod }} - {{ end }} - - + {{ end }} + {{ end }} diff --git a/templates/index.html b/templates/index.html index 52830d9..f803942 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,12 +2,11 @@ {{ template "head" . }} - -
-

{{ .meta.Title }}

-

{{ .meta.Description }}

-
+
+

{{ .meta.Title }}

+

{{ .meta.Description }}

+
{{ range .info }} diff --git a/templates/log.html b/templates/log.html index 4312d66..f4d15c7 100644 --- a/templates/log.html +++ b/templates/log.html @@ -1,23 +1,22 @@ {{ define "log" }} -{{ template "head" . }} - - {{ template "repoheader" . }} + {{ template "head" . }} + {{ template "repoheader" . }} {{ template "nav" . }}
{{ $repo := .name }}
{{ range .commits }} -
- -
{{ .Message }}
-
-
- {{ .Author.Name }} {{ .Author.Email }} -
{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
-
+
+ +
{{ .Message }}
+
+
+ {{ .Author.Name }} {{ .Author.Email }} +
{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
+
{{ end }}
diff --git a/templates/nav.html b/templates/nav.html index 3d40495..51a1e92 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -1,14 +1,14 @@ {{ define "nav" }} - {{ end }} diff --git a/templates/refs.html b/templates/refs.html index f121d3e..0138791 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -1,14 +1,13 @@ {{ define "refs" }} -{{ template "head" . }} - - {{ template "repoheader" . }} + {{ template "head" . }} + {{ template "repoheader" . }} {{ template "nav" . }}
{{ $name := .name }} -

branches

+

Branches

{{ range .branches }}
@@ -20,20 +19,20 @@ {{ end }}
{{ if .tags }} -

tags

-
- {{ range .tags }} -
- {{ .Name }} - browse - log - tar.gz - {{ if .Message }} -
{{ .Message }}
-
- {{ end }} - {{ end }} -
+

Tags

+
+ {{ range .tags }} +
+ {{ .Name }} + browse + log + tar.gz + {{ if .Message }} +
{{ .Message }}
+
+ {{ end }} + {{ end }} +
{{ end }}
diff --git a/templates/repo-header.html b/templates/repo-header.html index e0b293a..7be2d65 100644 --- a/templates/repo-header.html +++ b/templates/repo-header.html @@ -1,10 +1,9 @@ {{ define "repoheader" }}

- all repos - — {{ .displayname }} + all repos — {{ .displayname }} {{ if .ref }} - @ {{ .ref }} + @ {{ .ref }} {{ end }}

{{ .desc }}

diff --git a/templates/repo.html b/templates/repo.html index a9f4a49..6bcc294 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -1,37 +1,33 @@ {{ define "repo" }} -{{ template "head" . }} - -{{ template "repoheader" . }} - + {{ template "head" . }} + {{ template "repoheader" . }} {{ template "nav" . }}
{{ $repo := .name }}
{{ range .commits }} -
- -
{{ .Message }}
-
-
- {{ .Author.Name }} {{ .Author.Email }} -
{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
-
+
+ +
{{ .Message }}
+
+
+ {{ .Author.Name }} {{ .Author.Email }} +
{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
+
{{ end }}
-{{- if .readme }} -
- {{- .readme -}} -
-{{- end -}} + {{- if .readme }} +
+ {{- .readme -}} +
+ {{- end -}}
clone -
-git clone https://{{ .servername }}/{{ .name }}
-				
+
git clone https://{{ .servername }}/{{ .name }}
diff --git a/templates/tree.html b/templates/tree.html index 6e48dc1..6634a5c 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -1,54 +1,47 @@ {{ define "tree" }} - -{{ template "head" . }} - - {{ template "repoheader" . }} + {{ template "head" . }} + {{ template "repoheader" . }} {{ template "nav" . }}
{{ $repo := .name }} {{ $ref := .ref }} {{ $parent := .parent }} -
{{ if $parent }} -
-
- + {{ end }} {{ range .files }} - {{ if not .IsFile }} -
{{ .Mode }}
-
{{ .Size }}
-
- {{ if $parent }} - {{ .Name }}/ - {{ else }} - {{ .Name }}/ + {{ if not .IsFile }} +
{{ .Mode }}
+
{{ .Size }}
+
+ {{ if $parent }} + {{ .Name }}/ + {{ else }} + {{ .Name }}/ + {{ end }} +
{{ end }} -
- {{ end }} {{ end }} {{ range .files }} - {{ if .IsFile }} -
{{ .Mode }}
-
{{ .Size }}
-
- {{ if $parent }} - {{ .Name }} - {{ else }} - {{ .Name }} + {{ if .IsFile }} +
{{ .Mode }}
+
{{ .Size }}
+
+ {{ if $parent }} + {{ .Name }} + {{ else }} + {{ .Name }} + {{ end }} +
{{ end }} -
- {{ end }} {{ end }}
-
-					{{- if .readme }}{{ .readme }}{{- end -}}
-				
+
{{- if .readme }}{{ .readme }}{{- end -}}
-- cgit v1.2.3