diff options
-rw-r--r-- | templates/404.html | 17 | ||||
-rw-r--r-- | templates/500.html | 17 | ||||
-rw-r--r-- | templates/commit.html | 192 | ||||
-rw-r--r-- | templates/file.html | 46 | ||||
-rw-r--r-- | templates/head.html | 58 | ||||
-rw-r--r-- | templates/index.html | 30 | ||||
-rw-r--r-- | templates/log.html | 38 | ||||
-rw-r--r-- | templates/nav.html | 24 | ||||
-rw-r--r-- | templates/refs.html | 68 | ||||
-rw-r--r-- | templates/repo-header.html | 16 | ||||
-rw-r--r-- | templates/repo.html | 52 | ||||
-rw-r--r-- | templates/tree.html | 94 |
12 files changed, 322 insertions, 330 deletions
diff --git a/templates/404.html b/templates/404.html index bca9d35..dd8c813 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,14 +1,13 @@ {{ define "404" }} <!DOCTYPE html> <html> - <title>404</title> -{{ template "head" . }} - <body> - {{ template "nav" . }} - <main> - <h3>404 — nothing like that here.</h3> - </main> - </body> - + <title>404 Not Found</title> + {{ template "head" . }} + <body> + {{ template "nav" . }} + <main> + <h1>404 Not Found</h1> + </main> + </body> </html> {{ end }} diff --git a/templates/500.html b/templates/500.html index 164700c..6217541 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,14 +1,13 @@ {{ define "500" }} <!DOCTYPE html> <html> - <title>500</title> -{{ template "head" . }} - <body> - {{ template "nav" . }} - <main> - <h3>500 — something broke!</h3> - </main> - </body> - + <title>500</title> + {{ template "head" . }} + <body> + {{ template "nav" . }} + <main> + <h3>500 — something broke!</h3> + </main> + </body> </html> {{ end }} diff --git a/templates/commit.html b/templates/commit.html index 49f4574..c592523 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -2,104 +2,104 @@ <!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> - {{ 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> - <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 }} - {{ 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> + <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..a40f071 100644 --- a/templates/file.html +++ b/templates/file.html @@ -1,31 +1,25 @@ {{ 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> + </tbody></tr> + </table> + </div> + </main> + </body> </html> {{ end }} diff --git a/templates/head.html b/templates/head.html index b3f71c9..b5be55d 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="icon" type="image/png" size="32x32" href="/static/legit.png"> - {{ if .parent }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title> + <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 }} — {{ .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> + {{ 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/index.html b/templates/index.html index 740d2b3..52830d9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,20 +3,20 @@ <html> {{ template "head" . }} - <header> - <h1>{{ .meta.Title }}</h1> - <h2>{{ .meta.Description }}</h2> - </header> - <body> - <main> - <div class="index"> - {{ range .info }} - <div class="index-name"><a href="/{{ .Name }}">{{ .DisplayName }}</a></div> - <div class="desc">{{ .Desc }}</div> - <div>{{ .Idle }}</div> - {{ end }} - </div> - </main> - </body> + <header> + <h1>{{ .meta.Title }}</h1> + <h2>{{ .meta.Description }}</h2> + </header> + <body> + <main> + <div class="index"> + {{ range .info }} + <div class="index-name"><a href="/{{ .Name }}">{{ .DisplayName }}</a></div> + <div class="desc">{{ .Desc }}</div> + <div>{{ .Idle }}</div> + {{ end }} + </div> + </main> + </body> </html> {{ end }} diff --git a/templates/log.html b/templates/log.html index d097990..4312d66 100644 --- a/templates/log.html +++ b/templates/log.html @@ -3,24 +3,24 @@ <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 f0e591f..f121d3e 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -3,39 +3,39 @@ <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> - <a href="/{{ $name }}/archive/{{ .Name.Short }}.tar.gz">tar.gz</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> - <a href="/{{ $name }}/archive/{{ .Name }}.tar.gz">tar.gz</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> + <a href="/{{ $name }}/archive/{{ .Name.Short }}.tar.gz">tar.gz</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> + <a href="/{{ $name }}/archive/{{ .Name }}.tar.gz">tar.gz</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 0420da7..e0b293a 100644 --- a/templates/repo-header.html +++ b/templates/repo-header.html @@ -1,12 +1,12 @@ {{ define "repoheader" }} <header> - <h2> - <a href="/">all repos</a> - — {{ .displayname }} - {{ if .ref }} - <span class="ref">@ {{ .ref }}</span> - {{ end }} - </h2> - <h3 class="desc">{{ .desc }}</h3> + <h2> + <a href="/">all repos</a> + — {{ .displayname }} + {{ 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 68ab269..a9f4a49 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -5,35 +5,35 @@ {{ 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> + <div class="clone-url"> + <strong>clone</strong> + <pre> git clone https://{{ .servername }}/{{ .name }} - </pre> - </div> - </main> - </body> + </pre> + </div> + </main> + </body> </html> {{ end }} diff --git a/templates/tree.html b/templates/tree.html index 7ba065b..6e48dc1 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -4,53 +4,53 @@ {{ template "head" . }} - {{ template "repoheader" . }} - <body> - {{ template "nav" . }} - <main> - {{ $repo := .name }} - {{ $ref := .ref }} - {{ $parent := .parent }} + {{ 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> + <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 }} |