this repo has no description
1{{ define "title" }} commit {{ .Diff.Commit.This }} {{ end }}
2
3{{ define "repoContent" }}
4
5{{ $repo := .RepoInfo.FullName }}
6{{ $commit := .Diff.Commit }}
7{{ $stat := .Diff.Stat }}
8{{ $diff := .Diff.Diff }}
9
10<section class="commit">
11 <div id="commit-message">
12 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
13 <div>
14 {{ index $messageParts 0 }}
15 {{ if gt (len $messageParts) 1 }}
16 <p class="mt-1 cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
17 {{ end }}
18 </div>
19 </div>
20
21 <p class="text-sm text-gray-500">
22 <a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">{{ $commit.Author.Name }}</a>
23 <span class="px-1 select-none before:content-['\00B7']"></span>
24 {{ timeFmt $commit.Author.When }}
25 <span class="px-1 select-none before:content-['\00B7']"></span>
26 <span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
27 <span class="px-1 select-none before:content-['\00B7']"></span>
28 <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.This 0 8 }}</a>
29 {{ if $commit.Parent }}
30 <span class="select-none">←</span>
31 <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.Parent 0 8 }}</a>
32 {{ end }}
33 </p>
34 <div class="diff-stat">
35 <br>
36 <strong>jump to</strong>
37 {{ range $diff }}
38 <ul>
39 <li><a href="#file-{{ .Name.New }}">{{ .Name.New }}</a></li>
40 </ul>
41 {{ end }}
42 </div>
43</section>
44
45{{end}}
46
47{{ define "repoAfter" }}
48
49{{ $repo := .RepoInfo.FullName }}
50{{ $commit := .Diff.Commit }}
51{{ $stat := .Diff.Stat }}
52{{ $diff := .Diff.Diff }}
53
54 {{ $this := $commit.This }}
55 {{ $parent := $commit.Parent }}
56
57 {{ $last := sub (len $diff) 1 }}
58 {{ range $idx, $hunk := $diff }}
59 {{ with $hunk }}
60 <section class="mt-4 border border-black w-full mx-auto">
61 <div id="file-{{ .Name.New }}">
62 <div id="diff-file">
63 <details open>
64 <summary class="list-none cursor-pointer sticky top-0">
65 <div id="diff-file-header" class="border-b cursor-pointer bg-white border-black flex justify-between">
66 <div id="left-side-items" class="p-2">
67 {{ if .IsNew }}
68 <span class="diff-type">A</span>
69 {{ end }}
70 {{ if .IsDelete }}
71 <span class="diff-type">D</span>
72 {{ end }}
73 {{ if not (or .IsNew .IsDelete) }}
74 <span class="diff-type">M</span>
75 {{ end }}
76
77 {{ if .Name.Old }}
78 <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}" class="no-underline hover:underline">{{ .Name.Old }}</a>
79 {{ if .Name.New }}
80 →
81 <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}" class="no-underline hover:underline">{{ .Name.New }}</a>
82 {{ end }}
83 {{ else }}
84 <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}" class="no-underline hover:underline">{{ .Name.New }}</a>
85 {{- end -}}
86 </div>
87
88 <div id="right-side-items" class="p-2">
89 <a href="#file-{{ .Name.New }}" class="no-underline hover:underline">top of file</a>
90 {{ if gt $idx 0 }}
91 <span class="px-1 select-none before:content-['\00B7']"></span>
92 {{ $prev := index $diff (sub $idx 1) }}
93 <a href="#file-{{ $prev.Name.New }}" class="no-underline hover:underline">prev</a>
94 {{ end }}
95
96 {{ if lt $idx $last }}
97 <span class="px-1 select-none before:content-['\00B7']"></span>
98 {{ $next := index $diff (add $idx 1) }}
99 <a href="#file-{{ $next.Name.New }}" class="no-underline hover:underline">next</a>
100 {{ end }}
101 </div>
102
103 </div>
104 </summary>
105
106 {{ if .IsBinary }}
107 <p>Not showing binary file.</p>
108 {{ else }}
109 <pre class="overflow-auto">
110 {{- range .TextFragments -}}
111 <div class="bg-gray-100 text-gray-500 select-none">{{ .Comment }}</div>
112
113 {{- range .Lines -}}
114 {{- if eq .Op.String "+" -}}
115 <div class="bg-green-100 text-green-700"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
116 {{- end -}}
117
118 {{- if eq .Op.String "-" -}}
119 <div class="bg-red-100 text-red-700"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
120 {{- end -}}
121
122 {{- if eq .Op.String " " -}}
123 <div class="text-gray-500"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
124 {{- end -}}
125
126 {{- end -}}
127 {{- end -}}
128 </pre>
129 {{- end -}}
130
131 </details>
132
133 </div>
134 </div>
135 </section>
136 {{ end }}
137 {{ end }}
138
139{{end}}