A vibe coded tangled fork which supports pijul.
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 p-1 text-sm bg-green-100 rounded text-green-700 select-none">A</span>
69 {{ end }}
70 {{ if .IsDelete }}
71 <span class="diff-type p-1 text-sm bg-red-100 rounded text-red-700 select-none">D</span>
72 {{ end }}
73 {{ if not (or .IsNew .IsDelete) }}
74 <span class="diff-type p-1 bg-gray-100 text-sm rounded text-gray-700 select-none">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 {{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 rounded" }}
89 <div id="right-side-items" class="p-2 flex items-center">
90 <a title="top of file" href="#file-{{ .Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up-from-line"></i></a>
91 {{ if gt $idx 0 }}
92 {{ $prev := index $diff (sub $idx 1) }}
93 <a title="previous file" href="#file-{{ $prev.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up"></i></a>
94 {{ end }}
95
96 {{ if lt $idx $last }}
97 {{ $next := index $diff (add $idx 1) }}
98 <a title="next file" href="#file-{{ $next.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-down"></i></a>
99 {{ end }}
100 </div>
101
102 </div>
103 </summary>
104
105 {{ if .IsBinary }}
106 <p>Not showing binary file.</p>
107 {{ else }}
108 <pre class="overflow-auto">
109 {{- range .TextFragments -}}
110 <div class="bg-gray-100 text-gray-500 select-none">{{ .Header }}</div>
111 {{- range .Lines -}}
112 {{- if eq .Op.String "+" -}}
113 <div class="bg-green-100 text-green-700"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
114 {{- end -}}
115
116 {{- if eq .Op.String "-" -}}
117 <div class="bg-red-100 text-red-700"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
118 {{- end -}}
119
120 {{- if eq .Op.String " " -}}
121 <div class="text-gray-500"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
122 {{- end -}}
123
124 {{- end -}}
125 {{- end -}}
126 </pre>
127 {{- end -}}
128
129 </details>
130
131 </div>
132 </div>
133 </section>
134 {{ end }}
135 {{ end }}
136
137{{end}}