repos / pgit

static site generator for git
git clone https://github.com/picosh/pgit.git

pgit / html
Eric Bower · 17 Aug 23

commit.page.tmpl

 1{{template "base" .}}
 2{{define "title"}}{{.Commit.Summary}} - {{.Repo.RepoName}}@{{.CommitID}}{{end}}
 3{{define "meta"}}
 4<link rel="stylesheet" href="/syntax.css" />
 5{{end}}
 6
 7{{define "content"}}
 8  <dl>
 9    <dt>commit</dt>
10    <dd><a href="{{.CommitURL}}">{{.CommitID}}</a></dd>
11
12    <dt>parent</dt>
13    <dd><a href="{{.ParentURL}}">{{.Parent}}</a></dd>
14
15    <dt>author</dt>
16    <dd>{{.Commit.Author.Name}}</dd>
17
18    <dt>date</dt>
19    <dd>{{.Commit.Author.When}}</dd>
20  </dl>
21
22  <pre>{{.Commit.Message}}</pre>
23
24  <div class="box mono">
25    <div>
26      <strong>{{.Diff.NumFiles}}</strong> files changed,&nbsp;
27      <span class="color-green">+{{.Diff.TotalAdditions}}</span>,
28      <span class="color-red">-{{.Diff.TotalDeletions}}</span>
29    </div>
30
31    <div>
32    {{range .Diff.Files}}
33      <div class="my-sm">
34        <span>{{.FileType}}</span>
35        <a href="#diff-{{.Name}}">{{.Name}}</a>
36      </div>
37    {{end}}
38    </div>
39  </div>
40
41  {{range .Diff.Files}}
42    <div id="diff-{{.Name}}" class="flex justify-between mono">
43      <div>
44        <span>{{.FileType}} {{if eq .FileType "R"}}{{.OldName}} => {{end}}</span>
45        <a href="#diff-{{.Name}}">{{.Name}}</a>
46      </div>
47
48      <div>
49        <span class="color-green">+{{.NumAdditions}}</span>,
50        <span class="color-red">-{{.NumDeletions}}</span>
51      </div>
52    </div>
53
54    {{.Content}}
55  {{end}}
56{{end}}