From 7e04040e3510370d754c4afa94d78da24b43d13e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 27 Jul 2024 08:00:00 +0800 Subject: More HTML sanification --- templates/404.html | 6 ++++-- templates/500.html | 6 ++++-- templates/commit.html | 5 ++++- templates/file.html | 5 ++++- templates/head.html | 37 ++++++++----------------------------- templates/index.html | 5 ++++- templates/log.html | 5 ++++- templates/refs.html | 5 ++++- templates/repo-header.html | 2 +- templates/repo.html | 5 ++++- templates/tree.html | 11 ++++++++++- 11 files changed, 51 insertions(+), 41 deletions(-) (limited to 'templates') diff --git a/templates/404.html b/templates/404.html index 3a68101..382ee25 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,8 +1,10 @@ {{ define "404" }} - 404 Not Found - {{ template "head" . }} + + {{ template "generichead" . }} + 404 Not Found + {{ template "nav" . }}
diff --git a/templates/500.html b/templates/500.html index 77bb9ab..9c55dd1 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,8 +1,10 @@ {{ define "500" }} - 500 Internal Server Error - {{ template "head" . }} + + {{ template "generichead" . }} + 500 Internal Server Error + {{ template "nav" . }}
diff --git a/templates/commit.html b/templates/commit.html index c556fa8..665e9f9 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -1,7 +1,10 @@ {{ define "commit" }} - {{ template "head" . }} + + {{ template "generichead" . }} + {{ .meta.Title }} — {{ .name }}: {{ .commit.This }} + {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/file.html b/templates/file.html index 7dd5b86..de837a5 100644 --- a/templates/file.html +++ b/templates/file.html @@ -1,7 +1,10 @@ {{ define "file" }} - {{ template "head" . }} + + {{ template "generichead" . }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }} + {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/head.html b/templates/head.html index f2a3bda..ec53412 100644 --- a/templates/head.html +++ b/templates/head.html @@ -1,30 +1,9 @@ -{{ define "head" }} - - - - - - {{ if .parent }} - {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/ - {{ else if .path }} - {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }} - {{ else if .files }} - {{ .meta.Title }} — {{ .name }} ({{ .ref }}) - {{ else if .commit }} - {{ .meta.Title }} — {{ .name }}: {{ .commit.This }} - {{ else if .branches }} - {{ .meta.Title }} — {{ .name }}: refs - {{ else if .commits }} - {{ if .log }} - {{ .meta.Title }} — {{ .name }}: log - {{ else }} - {{ .meta.Title }} — {{ .name }} - {{ end }} - {{ else }} - {{ .meta.Title }} - {{ end }} - {{ if and .servername .gomod }} - - {{ end }} - +{{ define "generichead" }} + + + + +{{ if and .servername .gomod }} + +{{ end }} {{ end }} diff --git a/templates/index.html b/templates/index.html index f803942..93ac64b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,7 +1,10 @@ {{ define "index" }} -{{ template "head" . }} + + {{ template "generichead" . }} + {{ .meta.Title }} +

{{ .meta.Title }}

diff --git a/templates/log.html b/templates/log.html index f4d15c7..5a52a3b 100644 --- a/templates/log.html +++ b/templates/log.html @@ -1,7 +1,10 @@ {{ define "log" }} - {{ template "head" . }} + + {{ template "generichead" . }} + {{ .meta.Title }} — {{ .name }}: log + {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/refs.html b/templates/refs.html index 0138791..e6620c6 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -1,7 +1,10 @@ {{ define "refs" }} - {{ template "head" . }} + + {{ template "generichead" . }} + {{ .meta.Title }} — {{ .name }}: refs + {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/repo-header.html b/templates/repo-header.html index 7be2d65..e816ed3 100644 --- a/templates/repo-header.html +++ b/templates/repo-header.html @@ -3,7 +3,7 @@

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

{{ .desc }}

diff --git a/templates/repo.html b/templates/repo.html index 6bcc294..97dc8b0 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -1,7 +1,10 @@ {{ define "repo" }} - {{ template "head" . }} + + {{ template "generichead" . }} + {{ .meta.Title }} — {{ .name }} + {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/tree.html b/templates/tree.html index 6634a5c..939767a 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -1,7 +1,16 @@ {{ define "tree" }} - {{ template "head" . }} + + {{ template "generichead" . }} + {{ if .parent }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/ + {{ else if .files }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}) + {{ else }} + {{ .meta.Title }} — {{ .name }} ({{ .ref }}): BROKEN??? + {{ end }} + {{ template "repoheader" . }} {{ template "nav" . }} -- cgit v1.2.3