gtx


  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="en">
  <head>
    <base href="{{with .Base}}{{.}}{{else}}/{{end}}">
    <meta charset="utf-8">
    <title>{{.Title}}</title>
    <style>
      html {
        font: medium/normal serif;
      }
      a:target {
        outline: 1px dotted;
      }
      summary {
        font-size: large;
      }
      figcaption {
        font-weight: bold;
      }
      caption {
        caption-side: bottom;
      }
      @media (prefers-color-scheme: dark) {
        html {
          background: #171717;
          color: white;
        }
        a {
          color: deeppink;
        }
      }
    </style>
  </head>
  <body>
    <header>
      <h1><a href="./">{{with .Data.Project}}{{.}}{{else}}Home{{end}}</a></h1>
    </header>
    <main>
      <hr>
      {{- with .Data.Source}}
      <h2>Repository</h2>
      <p>Static archive for: <code>{{.}}</code></p>
      {{- end}}
      {{- with $list := .Data.Branches}}
      <h2>Branches</h2>
      {{- range $i, $item := $list}}
      <details{{if eq $i 0}} open{{end}}>
        <summary><samp><em><a href="branch/{{.Name}}/">{{.Name}}</a></em></samp></summary>
        {{- with and (len .Commits) (index .Commits 0) }}
        <dl>
          <dt>Author</dt>
          <dd>{{.Author.Name}} <{{.Author.Email}}></dd>
          <dt>Date</dt>
          <dd>
            <time datetime="{{.Date.Format "2006-01-02"}}">{{.Date.Format "Jan. 02 '06 15:04:05"}}</time>
          </dd>
          <dt>Commit</dt>
          <dd><a href="commit/{{.Hash}}/">{{.Hash}}</a></dd>
          <dt>Subject</dt>
          <dd>{{.Subject}}</dd>
        </dl>
        {{- end}}
      </details>
      {{- end}}
      {{- end}}
      {{- with .Data.Branch}}
      <h2>Branch: <a href="branch/{{.Name}}/">{{.Name}}</a></h2>
      <table>
        <caption>{{len .Commits}} commits total</caption>
        <thead>
          <tr>
            <th>Date</th>
            <th>Commit</th>
            <th>Subject</th>
            <th>Author</th>
          </tr>
        </thead>
        <tbody>
        {{- range .Commits}}
          <tr>
            <td>
              <time datetime="{{.Date.Format "2006-01-02"}}">{{.Date.Format "01/02/06 15:04"}}</time>
            </td>
            <td><samp>{{.Abbr}}</samp></td>
            <td><a href="commit/{{.Hash}}/">{{.Subject}}</a></td>
            <td>{{.Author.Name}}</td>
          </tr>
        {{- end}}
        </tbody>
      </table>
      {{- end}}
      {{- with .Data.Commit}}
      <h2>Branch: <a href="branch/{{.Branch}}/">{{.Branch}}</a></h2>
      <dl>
        <dt>Author</dt>
        <dd>{{.Author.Name}} <{{.Author.Email}}></dd>
        <dt>Date</dt>
        <dd>{{.Date.Format "Jan. 02 '06 15:04:05"}}</dd>
        <dt>Commit</dt>
        <dd><a href="commit/{{.Hash}}/">{{.Hash}}</a></dd>
        {{- range .Parents }}
        <dt>Parent</dt>
        <dd>
          <a href="commit/{{.}}">{{.}}</a>
          &laquo;
          <a href="commit/{{$.Data.Commit.Hash}}/diff-{{.}}.html">diff</a>
        </dd>
        {{- end }}
        {{- with .Body }}
        <dt>Message</dt>
        <dd><pre>{{.}}</pre></dd>
        {{- end }}
      </dl>
      {{- with $list := .History }}
      <figure>
        <figcaption>Overview</figcaption>
        {{- range $list }}
        <pre><code>{{diffstatbodyparser .}}</code></pre>
        {{- end }}
      </figure>
      {{- end }}
      <figure>
        <figcaption>File tree</figcaption>
        <ul>
        {{- range .Tree}}
        <li>
          <a href="commit/{{$.Data.Commit.Hash}}/{{.Path}}.html">{{.Path}}</a>
          <em><a href="object/{{.Dir}}" download="{{.Path}}">raw</a></em>
        </li>
        {{- end}}
        </ul>
      </figure>
      {{- end}}
      {{- with .Data.Diff}}
      <h2>Branch: <a href="branch/{{.Commit.Branch}}/">{{.Commit.Branch}}</a></h2>
      <dl>
        <dt>Author</dt>
        <dd>{{.Commit.Author.Name}} <{{.Commit.Author.Email}}></dd>
        <dt>Date</dt>
        <dd>{{.Commit.Date.Format "Jan. 02 '06 15:04:05"}}</dd>
        <dt>Commit</dt>
        <dd><a href="commit/{{.Commit.Hash}}/">{{.Commit.Hash}}</a></dd>
        <dt>Parent</dt>
        <dd>
          <a href="commit/{{$.Data.Diff.Parent}}">{{$.Data.Diff.Parent}}</a>
        </dd>
      </dl>
      <figure>
        <figcaption>Changes</figcaption>
        <pre>{{diffbodyparser .}}</pre>
      </figure>
      {{- end }}
      {{- with .Data.Object}}
      {{- $dir := .Dir}}
      <table>
        <tr>
          {{- with .Lines }}
          {{- $l := (printf "%d" (len .)) -}}
          <td>
            <pre>
            {{- range . -}}
              <a href="object/{{$dir}}.html#L{{.}}" id="L{{.}}">{{printf "%*d" (len $l) .}}</a><br>
            {{- end -}}
            </pre>
          </td>
          {{- end}}
          {{- if .Bin}}
          <td>
            <p>No text preview is available for <a href="object/{{.Dir}}" download="{{.Path}}">{{.Path}}</a>.</p>
          </td>
          {{- else}}
          <td><pre>{{.Body}}</pre></td>
          {{- end}}
        </tr>
      </table>
      {{- end }}
      <hr>
      <nav>
        <p>
        {{- if .Data.Branches}}
          home
        {{- else}}
          <a href="./">home</a>
          {{- with .Data.Path}}
            {{- with .Branch}} &rsaquo; <a href="branch/{{.}}/">{{.}}</a>{{- end}}
            {{- with .Commit}} &rsaquo; <a href="commit/{{.}}/">{{printf "%.7s" .}}</a>{{- end}}
          {{- end}}
          {{- with .Data.Branch}} &rsaquo; <span>{{.Name}}</span>{{- end}}
          {{- with .Data.Commit}} &rsaquo; <span>{{.Abbr}}</span>{{- end}}
          {{- with .Data.Object}} &rsaquo; <span>{{.Path}}</span>{{- end}}
          {{- with .Data.Diff.Commit}} &rsaquo; <span>{{.Abbr}}</span>{{- end}}
        {{- end}}
        </p>
      </nav>
      <hr>
    </main>
    <footer>
      <p>Made with <a href="https://github.com/thewhodidthis/gtx">gtx</a> &rsaquo;</p>
    </footer>
  </body>
</html>