forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
1{{ define "repo/fragments/splitDiff" }} 2{{ $name := .Id }} 3{{- $lineNrStyle := "min-w-[3.5rem] flex-shrink-0 select-none text-right bg-white dark:bg-gray-800" -}} 4{{- $linkStyle := "text-gray-400 dark:text-gray-500 hover:underline" -}} 5{{- $lineNrSepStyle := "pr-2 border-r border-gray-200 dark:border-gray-700" -}} 6{{- $containerStyle := "flex min-w-full items-center target:border target:rounded-sm target:border-yellow-200 target:dark:border-yellow-700 scroll-mt-20" -}} 7{{- $emptyStyle := "bg-gray-200/30 dark:bg-gray-700/30" -}} 8{{- $addStyle := "bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400" -}} 9{{- $delStyle := "bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 " -}} 10{{- $ctxStyle := "bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400" -}} 11{{- $opStyle := "w-5 flex-shrink-0 select-none text-center" -}} 12<div class="grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700"> 13<pre class="overflow-x-auto col-span-1"><div class="overflow-x-auto"><div class="min-w-full inline-block">{{- range .TextFragments -}}<div class="bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</div> 14 {{- range .LeftLines -}} 15 {{- if .IsEmpty -}} 16 <div class="{{ $emptyStyle }} {{ $containerStyle }}"> 17 <div class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><span aria-hidden="true" class="invisible">{{.LineNumber}}</span></div> 18 <div class="{{ $opStyle }}"><span aria-hidden="true" class="invisible">{{ .Op.String }}</span></div> 19 <div class="px-2 invisible" aria-hidden="true">{{ .Content }}</div> 20 </div> 21 {{- else if eq .Op.String "-" -}} 22 <div class="{{ $delStyle }} {{ $containerStyle }}" id="{{$name}}-O{{.LineNumber}}"> 23 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle }}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{.LineNumber}}">{{ .LineNumber }}</a></div> 24 <div class="{{ $opStyle }}">{{ .Op.String }}</div> 25 <div class="px-2">{{ .Content }}</div> 26 </div> 27 {{- else if eq .Op.String " " -}} 28 <div class="{{ $ctxStyle }} {{ $containerStyle }}" id="{{$name}}-O{{.LineNumber}}"> 29 <div class="{{ $lineNrStyle }} {{ $lineNrSepStyle }}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{.LineNumber}}">{{ .LineNumber }}</a></div> 30 <div class="{{ $opStyle }}">{{ .Op.String }}</div> 31 <div class="px-2">{{ .Content }}</div> 32 </div> 33 {{- end -}} 34 {{- end -}} 35 {{- end -}}</div></div></pre> 36 37<pre class="overflow-x-auto col-span-1"><div class="overflow-x-auto"><div class="min-w-full inline-block">{{- range .TextFragments -}}<div class="bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</div> 38 {{- range .RightLines -}} 39 {{- if .IsEmpty -}} 40 <div class="{{ $emptyStyle }} {{ $containerStyle }}"> 41 <div class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><span aria-hidden="true" class="invisible">{{.LineNumber}}</span></div> 42 <div class="{{ $opStyle }}"><span aria-hidden="true" class="invisible">{{ .Op.String }}</span></div> 43 <div class="px-2 invisible" aria-hidden="true">{{ .Content }}</div> 44 </div> 45 {{- else if eq .Op.String "+" -}} 46 <div class="{{ $addStyle }} {{ $containerStyle }}" id="{{$name}}-N{{.LineNumber}}"> 47 <div class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{.LineNumber}}">{{ .LineNumber }}</a></div> 48 <div class="{{ $opStyle }}">{{ .Op.String }}</div> 49 <div class="px-2" >{{ .Content }}</div> 50 </div> 51 {{- else if eq .Op.String " " -}} 52 <div class="{{ $ctxStyle }} {{ $containerStyle }}" id="{{$name}}-N{{.LineNumber}}"> 53 <div class="{{$lineNrStyle}} {{$lineNrSepStyle}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{.LineNumber}}">{{ .LineNumber }}</a></div> 54 <div class="{{ $opStyle }}">{{ .Op.String }}</div> 55 <div class="px-2">{{ .Content }}</div> 56 </div> 57 {{- end -}} 58 {{- end -}} 59 {{- end -}}</div></div></pre> 60</div> 61{{ end }}