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