Monorepo for Tangled tangled.org

add line numbers to diffs

Changed files
+47 -27
appview
+4
appview/pages/funcmap.go
··· 33 33 "add": func(a, b int) int { 34 34 return a + b 35 35 }, 36 + // the absolute state of go templates 37 + "add64": func(a, b int64) int64 { 38 + return a + b 39 + }, 36 40 "sub": func(a, b int) int { 37 41 return a - b 38 42 },
+37 -21
appview/pages/templates/fragments/diff.html
··· 81 81 This is a binary file and will not be displayed. 82 82 </p> 83 83 {{ else }} 84 - <pre class="overflow-x-auto"><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">{{- .Header -}}</div>{{- range .Lines -}} 85 - {{- if eq .Op.String "+" -}} 86 - <div class="bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400 flex min-w-full"> 87 - <div class="w-10 flex-shrink-0 select-none p-1 text-center">{{ .Op.String }}</div> 88 - <div class="p-1 whitespace-pre">{{ .Line }}</div> 89 - </div> 90 - {{- end -}} 91 - {{- if eq .Op.String "-" -}} 92 - <div class="bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 flex min-w-full"> 93 - <div class="w-10 flex-shrink-0 select-none p-1 text-center">{{ .Op.String }}</div> 94 - <div class="p-1 whitespace-pre">{{ .Line }}</div> 95 - </div> 96 - {{- end -}} 97 - {{- if eq .Op.String " " -}} 98 - <div class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 flex min-w-full"> 99 - <div class="w-10 flex-shrink-0 select-none p-1 text-center">{{ .Op.String }}</div> 100 - <div class="p-1 whitespace-pre">{{ .Line }}</div> 101 - </div> 102 - {{- end -}} 103 - {{- end -}} 104 - {{- end -}}</div></div></pre> 84 + <pre class="overflow-x-auto"><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> 85 + {{- $oldStart := .OldPosition -}} 86 + {{- $newStart := .NewPosition -}} 87 + {{- $lineNrStyle := "min-w-[3rem] flex-shrink-0 select-none text-right" -}} 88 + {{- $lineNrSepStyle1 := "text-gray-400 dark:text-gray-500 bg-white dark:bg-gray-800" -}} 89 + {{- $lineNrSepStyle2 := "text-gray-400 dark:text-gray-500 bg-white dark:bg-gray-800 pr-2" -}} 90 + {{- range .Lines -}} 91 + {{- if eq .Op.String "+" -}} 92 + <div class="bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400 flex min-w-full items-center"> 93 + <div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}"><span aria-hidden="true" class="invisible">{{$newStart}}</span></div> 94 + <div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}">{{ $newStart }}</div> 95 + <div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div> 96 + <div class="px-2">{{ .Line }}</div> 97 + </div> 98 + {{- $newStart = add64 $newStart 1 -}} 99 + {{- end -}} 100 + {{- if eq .Op.String "-" -}} 101 + <div class="bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 flex min-w-full items-center"> 102 + <div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}">{{ $oldStart }}</div> 103 + <div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}"><span aria-hidden="true" class="invisible">{{$oldStart}}</span></div> 104 + <div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div> 105 + <div class="px-2">{{ .Line }}</div> 106 + </div> 107 + {{- $oldStart = add64 $oldStart 1 -}} 108 + {{- end -}} 109 + {{- if eq .Op.String " " -}} 110 + <div class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 flex min-w-full items-center"> 111 + <div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}">{{ $oldStart }}</div> 112 + <div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}">{{ $newStart }}</div> 113 + <div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div> 114 + <div class="px-2">{{ .Line }}</div> 115 + </div> 116 + {{- $newStart = add64 $newStart 1 -}} 117 + {{- $oldStart = add64 $oldStart 1 -}} 118 + {{- end -}} 119 + {{- end -}} 120 + {{- end -}}</div></div></pre> 105 121 {{- end -}} 106 122 {{ end }} 107 123 </div>
+2 -2
appview/pages/templates/fragments/editRepoDescription.html
··· 1 1 {{ define "fragments/editRepoDescription" }} 2 2 <form hx-put="/{{ .RepoInfo.FullName }}/description" hx-target="this" hx-swap="outerHTML" class="flex flex-wrap gap-2"> 3 3 <input type="text" class="p-1" name="description" value="{{ .RepoInfo.Description }}"> 4 - <button type="submit" class="btn p-2 flex items-center gap-2 no-underline text-sm"> 4 + <button type="submit" class="btn p-1 flex items-center gap-2 no-underline text-sm"> 5 5 {{ i "check" "w-3 h-3" }} save 6 6 </button> 7 - <button type="button" class="btn p-2 flex items-center gap-2 no-underline text-sm" hx-get="/{{ .RepoInfo.FullName }}/description" > 7 + <button type="button" class="btn p-1 flex items-center gap-2 no-underline text-sm" hx-get="/{{ .RepoInfo.FullName }}/description" > 8 8 {{ i "x" "w-3 h-3" }} cancel 9 9 </button> 10 10 </form>
+3 -3
appview/pages/templates/fragments/repoDescription.html
··· 1 1 {{ define "fragments/repoDescription" }} 2 - <span id="repo-description" class="flex flex-wrap items-center gap-2" hx-target="this" hx-swap="outerHTML"> 2 + <span id="repo-description" class="flex flex-wrap items-center gap-2 text-sm" hx-target="this" hx-swap="outerHTML"> 3 3 {{ if .RepoInfo.Description }} 4 4 {{ .RepoInfo.Description }} 5 5 {{ else }} ··· 7 7 {{ end }} 8 8 9 9 {{ if .RepoInfo.Roles.IsOwner }} 10 - <button class="btn p-2 flex items-center gap-2 no-underline text-sm" hx-get="/{{ .RepoInfo.FullName }}/description/edit"> 11 - {{ i "pencil" "w-3 h-3" }} edit 10 + <button class="flex items-center gap-2 no-underline text-sm" hx-get="/{{ .RepoInfo.FullName }}/description/edit"> 11 + {{ i "pencil" "w-3 h-3" }} 12 12 </button> 13 13 {{ end }} 14 14 </span>
+1 -1
appview/pages/templates/repo/blob.html
··· 60 60 {{ else }} 61 61 <div class="overflow-auto relative"> 62 62 {{ if .ShowRendered }} 63 - <div id="blob-contents" class="prose dark:prose-invert p-6">{{ .RenderedContents }}</div> 63 + <div id="blob-contents" class="prose dark:prose-invert">{{ .RenderedContents }}</div> 64 64 {{ else }} 65 65 <div id="blob-contents" class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ $.Contents | escapeHtml }}</div> 66 66 {{ end }}