diff options
Diffstat (limited to '')
-rw-r--r-- | templates/404.html | 14 | ||||
-rw-r--r-- | templates/500.html | 14 | ||||
-rw-r--r-- | templates/commit.html | 172 | ||||
-rw-r--r-- | templates/file.html | 49 | ||||
-rw-r--r-- | templates/head.html | 60 | ||||
-rw-r--r-- | templates/log.html | 38 | ||||
-rw-r--r-- | templates/nav.html | 24 | ||||
-rw-r--r-- | templates/refs.html | 64 | ||||
-rw-r--r-- | templates/repo-header.html | 16 | ||||
-rw-r--r-- | templates/repo.html | 52 | ||||
-rw-r--r-- | templates/tree.html | 92 |
11 files changed, 285 insertions, 310 deletions
diff --git a/templates/404.html b/templates/404.html index cb61c83..4f32abc 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,13 +1,13 @@ {{ define "404" }} <!DOCTYPE html> <html> - <title>404</title> + <title>404</title> {{ template "head" . }} - <body> - {{ template "nav" . }} - <main> - <h3>404 — nothing like that here.</h3> - </main> - </body> + <body> + {{ template "nav" . }} + <main> + <h3>404 — nothing like that here.</h3> + </main> + </body> </html> {{ end }} diff --git a/templates/500.html b/templates/500.html index c24f360..9f0657f 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,13 +1,13 @@ {{ define "500" }} <!DOCTYPE html> <html> - <title>500</title> + <title>500</title> {{ template "head" . }} - <body> - {{ template "nav" . }} - <main> - <h3>500 — something broke!</h3> - </main> - </body> + <body> + {{ template "nav" . }} + <main> + <h3>500 — something broke!</h3> + </main> + </body> </html> {{ end }} diff --git a/templates/commit.html b/templates/commit.html index f9166f1..115024b 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -2,100 +2,82 @@ <!DOCTYPE html> <html> {{ template "head" . }} - {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - <section class="commit"> - <pre> - {{- .commit.Message -}} - </pre> - <div class="commit-info"> - {{ .commit.Author.Name }} <a href="mailto:{{ .commit.Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</a> - <div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> - </div> - <div> - <strong>commit</strong> - <p><a href="/{{ .name }}/commit/{{ .commit.This }}" class="commit-hash"> - {{ .commit.This }} - </a> - </p> - </div> - {{ if .commit.Parent }} - <div> - <strong>parent</strong> - <p><a href="/{{ .name }}/commit/{{ .commit.Parent }}" class="commit-hash"> - {{ .commit.Parent }} - </a></p> - </div> - {{ end }} - <div class="diff-stat"> - <div> - {{ .stat.FilesChanged }} files changed, - {{ .stat.Insertions }} insertions(+), - {{ .stat.Deletions }} deletions(-) - </div> - <div> - <br> - <strong>jump to</strong> - {{ range .diff }} - <ul> - <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li> - </ul> - {{ end }} - </div> - </div> - </section> - <section> - {{ $repo := .name }} - {{ $this := .commit.This }} - {{ $parent := .commit.Parent }} - {{ range .diff }} - <div id="{{ .Name.New }}"> - <div class="diff"> - {{ if .IsNew }} - <span class="diff-type">A</span> - {{ end }} - {{ if .IsDelete }} - <span class="diff-type">D</span> - {{ end }} - {{ if not (or .IsNew .IsDelete) }} - <span class="diff-type">M</span> - {{ end }} - {{ if .Name.Old }} - <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a> - {{ if .Name.New }} - → - <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> - {{ end }} - {{ else }} - <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> - {{- end -}} - {{ if .IsBinary }} - <p>Not showing binary file.</p> - {{ else }} - <pre> - {{- range .TextFragments -}} - <p>{{- .Header -}}</p> - {{- range .Lines -}} - {{- if eq .Op.String "+" -}} - <span class="diff-add">{{ .String }}</span> - {{- end -}} - {{- if eq .Op.String "-" -}} - <span class="diff-del">{{ .String }}</span> - {{- end -}} - {{- if eq .Op.String " " -}} - <span class="diff-noop">{{ .String }}</span> - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - </pre> - </div> - </div> - {{ end }} - </section> - </main> - </body> + {{ template "repoheader" . }} + <body> + {{ template "nav" . }} + <main> + <section class="commit"> + <pre>{{- .commit.Message -}}</pre> + <div class="commit-info"> + {{ .commit.Author.Name }} <a href="mailto:{{ .commit.Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</a> + <div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> + </div> + <div> + <strong>commit</strong> + <p><a href="/{{ .name }}/commit/{{ .commit.This }}" class="commit-hash"> + {{ .commit.This }} + </a> + </p> + </div> + {{ if .commit.Parent }} + <div> + <strong>parent</strong> + <p><a href="/{{ .name }}/commit/{{ .commit.Parent }}" class="commit-hash"> + {{ .commit.Parent }} + </a></p> + </div> + {{ end }} + <div class="diff-stat"> + <div> + {{ .stat.FilesChanged }} files changed, + {{ .stat.Insertions }} insertions(+), + {{ .stat.Deletions }} deletions(-) + </div> + <div> + <br> + <strong>jump to</strong> + {{ range .diff }} + <ul> + <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li> + </ul> + {{ end }} + </div> + </div> + </section> + <section> + {{ $repo := .name }} + {{ $this := .commit.This }} + {{ $parent := .commit.Parent }} + {{ range .diff }} + <div id="{{ .Name.New }}"> + <div class="diff"> + {{ if .IsNew }} + <span class="diff-type">A</span> + {{ end }} + {{ if .IsDelete }} + <span class="diff-type">D</span> + {{ end }} + {{ if not (or .IsNew .IsDelete) }} + <span class="diff-type">M</span> + {{ end }} + {{ if .Name.Old }} + <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a> + {{ if .Name.New }} + → + <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> + {{ end }} + {{ else }} + <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> + {{- end -}} + {{ if .IsBinary }} + <p>Not showing binary file.</p> + {{ else }} + <pre>{{- range .TextFragments -}}<p>{{- .Header -}}</p>{{- range .Lines -}}{{- if eq .Op.String "+" -}}<span class="diff-add">{{ .String }}</span>{{- end -}}{{- if eq .Op.String "-" -}}<span class="diff-del">{{ .String }}</span>{{- end -}}{{- if eq .Op.String " " -}}<span class="diff-noop">{{ .String }}</span>{{- end -}}{{- end -}}{{- end -}}{{- end -}}</pre> + </div> + </div> + {{ end }} + </section> + </main> + </body> </html> {{ end }} diff --git a/templates/file.html b/templates/file.html index d18340a..c229611 100644 --- a/templates/file.html +++ b/templates/file.html @@ -1,31 +1,28 @@ {{ define "file" }} <!DOCTYPE html> <html> - {{ template "head" . }} - {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - <p>{{ .path }} (<a style="color: gray" href="?raw=true">view raw</a>)</p> - <div class="file-wrapper"> - <table > - <tbody><tr> - <td class="line-numbers"> - <pre> - {{- range .linecount }} - <a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a> - {{- end -}} - </pre> - </td> - <td class="file-content"> - <pre> - {{- .content -}} - </pre> - </td> - </tbody></tr> - </table> - </div> - </main> - </body> + {{ template "head" . }} + {{ template "repoheader" . }} + <body> + {{ template "nav" . }} + <main> + <p>{{ .path }} (<a style="color: gray" href="?raw=true">view raw</a>)</p> + <div class="file-wrapper"> + <table> + <tbody> + <tr> + <td class="line-numbers"> + <pre>{{- range .linecount }}<a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a>{{- end -}}</pre> + </td> + <td class="file-content"> + <pre>{{- .content -}}</pre> + </td> + </tr> + </tbody> + <!--TODO: Why is it like this???--> + </table> + </div> + </main> + </body> </html> {{ end }} diff --git a/templates/head.html b/templates/head.html index a6685e6..77c849a 100644 --- a/templates/head.html +++ b/templates/head.html @@ -1,32 +1,32 @@ {{ 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="stylesheet" href="https://cdn.icyphox.sh/fonts/inter.css" type="text/css"> - <link rel="icon" type="image/png" size="32x32" href="/static/legit.png"> - {{ if .parent }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title> - {{ else if .path }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }}</title> - {{ else if .files }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }})</title> - {{ else if .commit }} - <title>{{ .meta.Title }} — {{ .name }}: {{ .commit.This }}</title> - {{ else if .branches }} - <title>{{ .meta.Title }} — {{ .name }}: refs</title> - {{ else if .commits }} - {{ if .log }} - <title>{{ .meta.Title }} — {{ .name }}: log</title> - {{ else }} - <title>{{ .meta.Title }} — {{ .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 }} - <!-- other meta tags here --> - </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="stylesheet" href="https://cdn.icyphox.sh/fonts/inter.css" type="text/css"> + <link rel="icon" type="image/png" size="32x32" href="/static/legit.png"> + {{ if .parent }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title> + {{ else if .path }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }}</title> + {{ else if .files }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }})</title> + {{ else if .commit }} + <title>{{ .meta.Title }} — {{ .name }}: {{ .commit.This }}</title> + {{ else if .branches }} + <title>{{ .meta.Title }} — {{ .name }}: refs</title> + {{ else if .commits }} + {{ if .log }} + <title>{{ .meta.Title }} — {{ .name }}: log</title> + {{ else }} + <title>{{ .meta.Title }} — {{ .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 }} + <!-- other meta tags here --> +</head> {{ end }} diff --git a/templates/log.html b/templates/log.html index 7ff39a3..c75d9d7 100644 --- a/templates/log.html +++ b/templates/log.html @@ -2,24 +2,24 @@ <!DOCTYPE html> <html> {{ template "head" . }} - {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - {{ $repo := .name }} - <div class="log"> - {{ range .commits }} - <div> - <div><a href="/{{ $repo }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div> - <pre>{{ .Message }}</pre> - </div> - <div class="commit-info"> - {{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a> - <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> - </div> - {{ end }} - </div> - </main> - </body> + {{ template "repoheader" . }} + <body> + {{ template "nav" . }} + <main> + {{ $repo := .name }} + <div class="log"> + {{ range .commits }} + <div> + <div><a href="/{{ $repo }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div> + <pre>{{ .Message }}</pre> + </div> + <div class="commit-info"> + {{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a> + <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> + </div> + {{ end }} + </div> + </main> + </body> </html> {{ end }} diff --git a/templates/nav.html b/templates/nav.html index 51c9a34..3d40495 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -1,14 +1,14 @@ {{ define "nav" }} - <nav> - <ul> - {{ if .name }} - <li><a href="/{{ .name }}">summary</a> - <li><a href="/{{ .name }}/refs">refs</a> - {{ if .ref }} - <li><a href="/{{ .name }}/tree/{{ .ref }}/">tree</a> - <li><a href="/{{ .name }}/log/{{ .ref }}">log</a> - {{ end }} - {{ end }} - </ul> - </nav> + <nav> + <ul> + {{ if .name }} + <li><a href="/{{ .name }}">summary</a> + <li><a href="/{{ .name }}/refs">refs</a> + {{ if .ref }} + <li><a href="/{{ .name }}/tree/{{ .ref }}/">tree</a> + <li><a href="/{{ .name }}/log/{{ .ref }}">log</a> + {{ end }} + {{ end }} + </ul> + </nav> {{ end }} diff --git a/templates/refs.html b/templates/refs.html index 127ee76..d8a3be0 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -2,37 +2,37 @@ <!DOCTYPE html> <html> {{ template "head" . }} - {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - {{ $name := .name }} - <h3>branches</h3> - <div class="refs"> - {{ range .branches }} - <div> - <strong>{{ .Name.Short }}</strong> - <a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a> - <a href="/{{ $name }}/log/{{ .Name.Short }}">log</a> - </div> - {{ end }} - </div> - {{ if .tags }} - <h3>tags</h3> - <div class="refs"> - {{ range .tags }} - <div> - <strong>{{ .Name }}</strong> - <a href="/{{ $name }}/tree/{{ .Name }}/">browse</a> - <a href="/{{ $name }}/log/{{ .Name }}">log</a> - {{ if .Message }} - <pre>{{ .Message }}</pre> - </div> - {{ end }} - {{ end }} - </div> - {{ end }} - </main> - </body> + {{ template "repoheader" . }} + <body> + {{ template "nav" . }} + <main> + {{ $name := .name }} + <h3>branches</h3> + <div class="refs"> + {{ range .branches }} + <div> + <strong>{{ .Name.Short }}</strong> + <a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a> + <a href="/{{ $name }}/log/{{ .Name.Short }}">log</a> + </div> + {{ end }} + </div> + {{ if .tags }} + <h3>tags</h3> + <div class="refs"> + {{ range .tags }} + <div> + <strong>{{ .Name }}</strong> + <a href="/{{ $name }}/tree/{{ .Name }}/">browse</a> + <a href="/{{ $name }}/log/{{ .Name }}">log</a> + {{ if .Message }} + <pre>{{ .Message }}</pre> + </div> + {{ end }} + {{ end }} + </div> + {{ end }} + </main> + </body> </html> {{ end }} diff --git a/templates/repo-header.html b/templates/repo-header.html index f358278..38be1cc 100644 --- a/templates/repo-header.html +++ b/templates/repo-header.html @@ -1,12 +1,12 @@ {{ define "repoheader" }} <header> - <h2> - <a href="/">all repos</a> - — {{ .name }} - {{ if .ref }} - <span class="ref">@ {{ .ref }}</span> - {{ end }} - </h2> - <h3 class="desc">{{ .desc }}</h3> + <h2> + <a href="/">all repos</a> + — {{ .name }} + {{ if .ref }} + <span class="ref">@ {{ .ref }}</span> + {{ end }} + </h2> + <h3 class="desc">{{ .desc }}</h3> </header> {{ end }} diff --git a/templates/repo.html b/templates/repo.html index eac5d35..86e0d60 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -3,34 +3,32 @@ <html> {{ template "head" . }} {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - {{ $repo := .name }} - <div class="log"> - {{ range .commits }} - <div> - <div><a href="/{{ $repo }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div> - <pre>{{ .Message }}</pre> - </div> - <div class="commit-info"> - {{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a> - <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> - </div> - {{ end }} - </div> + <body> + {{ template "nav" . }} + <main> + {{ $repo := .name }} + <div class="log"> + {{ range .commits }} + <div> + <div><a href="/{{ $repo }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div> + <pre>{{ .Message }}</pre> + </div> + <div class="commit-info"> + {{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a> + <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> + </div> + {{ end }} + </div> {{- if .readme }} - <article class="readme"> - {{- .readme -}} - </article> + <article class="readme"> + {{- .readme -}} + </article> {{- end -}} - <div class="clone-url"> - <strong>clone</strong> - <pre> -git clone https://{{ .servername }}/{{ .name }} - </pre> - </div> - </main> - </body> + <div class="clone-url"> + <strong>clone</strong> + <pre>git clone https://{{ .servername }}/{{ .name }}</pre> + </div> + </main> + </body> </html> {{ end }} diff --git a/templates/tree.html b/templates/tree.html index ba72464..2e439c8 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -2,52 +2,50 @@ <!DOCTYPE html> <html> {{ template "head" . }} - {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - {{ $repo := .name }} - {{ $ref := .ref }} - {{ $parent := .parent }} - <div class="tree"> - {{ if $parent }} - <div></div> - <div></div> - <div><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></div> - {{ end }} - {{ range .files }} - {{ if not .IsFile }} - <div class="mode">{{ .Mode }}</div> - <div class="size">{{ .Size }}</div> - <div> - {{ if $parent }} - <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a> - {{ else }} - <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a> - {{ end }} - </div> - {{ end }} - {{ end }} - {{ range .files }} - {{ if .IsFile }} - <div class="mode">{{ .Mode }}</div> - <div class="size">{{ .Size }}</div> - <div> - {{ if $parent }} - <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a> - {{ else }} - <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a> - {{ end }} - </div> - {{ end }} - {{ end }} - </div> - <article> - <pre> - {{- if .readme }}{{ .readme }}{{- end -}} - </pre> - </article> - </main> - </body> + {{ template "repoheader" . }} + <body> + {{ template "nav" . }} + <main> + {{ $repo := .name }} + {{ $ref := .ref }} + {{ $parent := .parent }} + <div class="tree"> + {{ if $parent }} + <div></div> + <div></div> + <div><a href="/{{ $repo }}/tree/{{ $ref }}/{{ .dotdot }}">..</a></div> + {{ end }} + {{ range .files }} + {{ if not .IsFile }} + <div class="mode">{{ .Mode }}</div> + <div class="size">{{ .Size }}</div> + <div> + {{ if $parent }} + <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a> + {{ else }} + <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a> + {{ end }} + </div> + {{ end }} + {{ end }} + {{ range .files }} + {{ if .IsFile }} + <div class="mode">{{ .Mode }}</div> + <div class="size">{{ .Size }}</div> + <div> + {{ if $parent }} + <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a> + {{ else }} + <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a> + {{ end }} + </div> + {{ end }} + {{ end }} + </div> + <article> + <pre>{{- if .readme }}{{ .readme }}{{- end -}}</pre> + </article> + </main> + </body> </html> {{ end }} |