this repo has no description
1{{ define "repo/fragments/unifiedDiff" }}
2 {{ $name := .Id }}
3 <pre
4 class="overflow-x-auto"><div class="overflow-x-auto"><div class="min-w-full inline-block">{{- range .TextFragments -}}
5 <div
6 class="bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">
7 ···
8 </div>
9 {{- $oldStart := .OldPosition -}}
10 {{- $newStart := .NewPosition -}}
11 {{- $lineNrStyle := "min-w-[3.5rem] flex-shrink-0 select-none text-right bg-white dark:bg-gray-800 target:bg-yellow-200 target:dark:bg-yellow-600" -}}
12 {{- $linkStyle := "text-gray-400 dark:text-gray-500 hover:underline" -}}
13 {{- $lineNrSepStyle1 := "" -}}
14 {{- $lineNrSepStyle2 := "pr-2 border-r border-gray-200 dark:border-gray-700" -}}
15 {{- $containerStyle := "flex min-w-full items-center target:border target:rounded-sm target:border-yellow-200 target:dark:border-yellow-700 scroll-mt-20" -}}
16 {{- $addStyle := "bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400 " -}}
17 {{- $delStyle := "bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 " -}}
18 {{- $ctxStyle := "bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400" -}}
19 {{- $opStyle := "w-5 flex-shrink-0 select-none text-center" -}}
20 {{- range .Lines -}}
21 {{- if eq .Op.String "+" -}}
22 <div
23 class="{{ $addStyle }} {{ $containerStyle }}"
24 id="{{ $name }}-N{{ $newStart }}">
25 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle1 }}">
26 <span aria-hidden="true" class="invisible">{{ $newStart }}</span>
27 </div>
28 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle2 }}">
29 <a class="{{ $linkStyle }}" href="#{{ $name }}-N{{ $newStart }}">
30 {{ $newStart }}
31 </a>
32 </div>
33 <div class="{{ $opStyle }}">{{ .Op.String }}</div>
34 <div class="px-2">{{ .Line }}</div>
35 </div>
36 {{- $newStart = add64 $newStart 1 -}}
37 {{- end -}}
38 {{- if eq .Op.String "-" -}}
39 <div
40 class="{{ $delStyle }} {{ $containerStyle }}"
41 id="{{ $name }}-O{{ $oldStart }}">
42 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle1 }}">
43 <a class="{{ $linkStyle }}" href="#{{ $name }}-O{{ $oldStart }}">
44 {{ $oldStart }}
45 </a>
46 </div>
47 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle2 }}">
48 <span aria-hidden="true" class="invisible">{{ $oldStart }}</span>
49 </div>
50 <div class="{{ $opStyle }}">{{ .Op.String }}</div>
51 <div class="px-2">{{ .Line }}</div>
52 </div>
53 {{- $oldStart = add64 $oldStart 1 -}}
54 {{- end -}}
55 {{- if eq .Op.String " " -}}
56 <div
57 class="{{ $ctxStyle }} {{ $containerStyle }}"
58 id="{{ $name }}-O{{ $oldStart }}-N{{ $newStart }}">
59 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle1 }}">
60 <a
61 class="{{ $linkStyle }}"
62 href="#{{ $name }}-O{{ $oldStart }}-N{{ $newStart }}">
63 {{ $oldStart }}
64 </a>
65 </div>
66 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle2 }}">
67 <a
68 class="{{ $linkStyle }}"
69 href="#{{ $name }}-O{{ $oldStart }}-N{{ $newStart }}">
70 {{ $newStart }}
71 </a>
72 </div>
73 <div class="{{ $opStyle }}">{{ .Op.String }}</div>
74 <div class="px-2">{{ .Line }}</div>
75 </div>
76 {{- $newStart = add64 $newStart 1 -}}
77 {{- $oldStart = add64 $oldStart 1 -}}
78 {{- end -}}
79 {{- end -}}
80 {{- end -}}</div></div></pre>
81{{ end }}