forked from tangled.org/core
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">&LeftArrow;</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 mr-1 font-mono 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 mr-1 font-mono 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 mr-1 font-mono bg-gray-100 text-sm rounded text-gray-700 select-none">M</span> 75 {{ end }} 76 77 <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}" class="no-underline hover:underline">{{ .Name.New }}</a> 78 </div> 79 80 {{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 rounded" }} 81 <div id="right-side-items" class="p-2 flex items-center"> 82 <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> 83 {{ if gt $idx 0 }} 84 {{ $prev := index $diff (sub $idx 1) }} 85 <a title="previous file" href="#file-{{ $prev.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up"></i></a> 86 {{ end }} 87 88 {{ if lt $idx $last }} 89 {{ $next := index $diff (add $idx 1) }} 90 <a title="next file" href="#file-{{ $next.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-down"></i></a> 91 {{ end }} 92 </div> 93 94 </div> 95 </summary> 96 97 {{ if .IsBinary }} 98 <p>Not showing binary file.</p> 99 {{ else }} 100 <pre class="overflow-auto"> 101 {{- range .TextFragments -}} 102 <div class="bg-gray-100 text-gray-500 select-none">{{ .Header }}</div> 103 {{- range .Lines -}} 104 {{- if eq .Op.String "+" -}} 105 <div class="bg-green-100 text-green-700 p-1"><span class="select-none mr-2">{{ .Op.String }}</span><span>{{ .Line }}</span></div> 106 {{- end -}} 107 108 {{- if eq .Op.String "-" -}} 109 <div class="bg-red-100 text-red-700 p-1"><span class="select-none mr-2">{{ .Op.String }}</span><span>{{ .Line }}</span></div> 110 {{- end -}} 111 112 {{- if eq .Op.String " " -}} 113 <div class="text-gray-500 px"><span class="select-none mr-2">{{ .Op.String }}</span><span>{{ .Line }}</span></div> 114 {{- end -}} 115 116 {{- end -}} 117 {{- end -}} 118 </pre> 119 {{- end -}} 120 121 </details> 122 123 </div> 124 </div> 125 </section> 126 {{ end }} 127 {{ end }} 128 129{{end}}