aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-07-27 08:00:00 +0800
committerRunxi Yu <me@runxiyu.org>2024-07-27 08:00:00 +0800
commit7e04040e3510370d754c4afa94d78da24b43d13e (patch)
tree6613ec1419aa64cab78ff89d4d026ff7a8e74a23
parentSome more HTML sanities (diff)
downloadlegitrx-7e04040e3510370d754c4afa94d78da24b43d13e.tar.gz
legitrx-7e04040e3510370d754c4afa94d78da24b43d13e.tar.zst
legitrx-7e04040e3510370d754c4afa94d78da24b43d13e.zip
More HTML sanification
-rw-r--r--.editorconfig11
-rw-r--r--templates/404.html6
-rw-r--r--templates/500.html6
-rw-r--r--templates/commit.html5
-rw-r--r--templates/file.html5
-rw-r--r--templates/head.html37
-rw-r--r--templates/index.html5
-rw-r--r--templates/log.html5
-rw-r--r--templates/refs.html5
-rw-r--r--templates/repo-header.html2
-rw-r--r--templates/repo.html5
-rw-r--r--templates/tree.html11
12 files changed, 62 insertions, 41 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..b4c8f40
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,11 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = tab
+indent_size = 8
+
+[*.html]
+indent_style = tab
+indent_size = 4
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" }}
<!DOCTYPE html>
<html>
- <title>404 Not Found</title>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>404 Not Found</title>
+ </head>
<body>
{{ template "nav" . }}
<main>
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" }}
<!DOCTYPE html>
<html>
- <title>500 Internal Server Error</title>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>500 Internal Server Error</title>
+ </head>
<body>
{{ template "nav" . }}
<main>
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" }}
<!DOCTYPE html>
<html>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }}: {{ .commit.This }}</title>
+ </head>
<body>
{{ 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" }}
<!DOCTYPE html>
<html>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .path }}</title>
+ </head>
<body>
{{ 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" }}
-<head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" href="/static/style.css" type="text/css" />
- <link rel="icon" type="image/png" size="32x32" href="/static/legit.png" />
- {{ if .parent }}
- <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .parent }}/</title>
- {{ else if .path }}
- <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .path }}</title>
- {{ else if .files }}
- <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }})</title>
- {{ else if .commit }}
- <title>{{ .meta.Title }} &mdash; {{ .name }}: {{ .commit.This }}</title>
- {{ else if .branches }}
- <title>{{ .meta.Title }} &mdash; {{ .name }}: refs</title>
- {{ else if .commits }}
- {{ if .log }}
- <title>{{ .meta.Title }} &mdash; {{ .name }}: log</title>
- {{ else }}
- <title>{{ .meta.Title }} &mdash; {{ .name }}</title>
- {{ end }}
- {{ else }}
- <title>{{ .meta.Title }}</title>
- {{ end }}
- {{ if and .servername .gomod }}
- <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}">
- {{ end }}
-</head>
+{{ define "generichead" }}
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<link rel="stylesheet" href="/static/style.css" type="text/css" />
+<link rel="icon" type="image/png" size="32x32" href="/static/legit.png" />
+{{ if and .servername .gomod }}
+ <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}">
+{{ 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" }}
<!DOCTYPE html>
<html>
-{{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>{{ .meta.Title }}</title>
+ </head>
<body>
<header>
<h1>{{ .meta.Title }}</h1>
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" }}
<!DOCTYPE html>
<html>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }}: log</title>
+ </head>
<body>
{{ 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" }}
<!DOCTYPE html>
<html>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }}: refs</title>
+ </head>
<body>
{{ 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 @@
<h2>
<a href="/">all repos</a> &mdash; {{ .displayname }}
{{ if .ref }}
- <span class="ref">@ {{ .ref }}</span>
+ <span class="ref">{{ .ref }}</span>
{{ end }}
</h2>
<h3 class="desc">{{ .desc }}</h3>
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" }}
<!DOCTYPE html>
<html>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }}</title>
+ </head>
<body>
{{ 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" }}
<!DOCTYPE html>
<html>
- {{ template "head" . }}
+ <head>
+ {{ template "generichead" . }}
+ {{ if .parent }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .parent }}/</title>
+ {{ else if .files }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }})</title>
+ {{ else }}
+ <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): BROKEN???</title>
+ {{ end }}
+ </head>
<body>
{{ template "repoheader" . }}
{{ template "nav" . }}