repos / pgit

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

pgit / html
Eric Bower · 14 Jan 24

tree.page.tmpl

 1{{template "base" .}}
 2
 3{{define "title"}}files - {{.Repo.RepoName}}@{{.RevData.Name}}{{end}}
 4{{define "meta"}}{{end}}
 5
 6{{define "content"}}
 7  <div>
 8    <div class="text-md mb">
 9      {{range .Tree.Crumbs}}
10        {{if .IsLast}}
11          <span class="font-bold">{{.Text}}</span>
12        {{else}}
13          <a href="{{.URL}}">{{.Text}}</a> {{if .IsLast}}{{else}}/{{end}}
14        {{end}}
15      {{end}}
16    </div>
17
18    {{range .Tree.Items}}
19      <div class="flex justify-between items-center gap-2 p tree-row border-b">
20        <div class="flex-1 tree-path flex items-center gap">
21          {{if .IsDir}}
22            <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="16" width="16" viewBox="0 0 512 512">
23              <path d="M0 96C0 60.7 28.7 32 64 32H196.1c19.1 0 37.4 7.6 50.9 21.1L289.9 96H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16H286.6c-10.6 0-20.8-4.2-28.3-11.7L213.1 87c-4.5-4.5-10.6-7-17-7H64z"/>
24            </svg>
25          {{else}}
26            <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="16" width="16" viewBox="0 0 384 512">
27              <path d="M320 464c8.8 0 16-7.2 16-16V160H256c-17.7 0-32-14.3-32-32V48H64c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H320zM0 64C0 28.7 28.7 0 64 0H229.5c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64z"/>
28            </svg>
29          {{end}}
30
31          <a href="{{.URL}}">{{.Name}}</a>
32        </div>
33
34        <div class="flex items-center gap">
35          {{if $.Repo.HideTreeLastCommit}}
36          {{else}}
37          <div class="flex-1 tree-commit">
38            <a href="{{.CommitURL}}" title="{{.Summary}}">{{.When}}</a>
39          </div>
40          {{end}}
41          <div class="tree-size">
42            {{if .IsDir}}
43            {{else}}
44              {{if .IsTextFile}}{{.NumLines}} L{{else}}{{.Size}}{{end}}
45            {{end}}
46          </div>
47        </div>
48      </div>
49    {{end}}
50  </div>
51{{end}}