17 lines
944 B
1
{{ define "repoContent" }}
2
{{ $lines := split .Contents }}
3
{{ $tot_lines := len $lines }}
4
{{ $tot_chars := len (printf "%d" $tot_lines) }}
5
{{ $code_number_style := "text-gray-400 left-0 bg-white text-right mr-2 select-none" }}
6
<div class="pb-2 text-lg">
7
{{ range .PathElems }}
8
<a href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ . }}" class="text-bold text-gray-500">{{ . }}</a> /
9
{{ end }}<span class="">{{ .File }}</span>
10
</div>
11
12
13
{{ if .IsBinary }}<p class="text-center text-gray-400">This is a binary file and will not be displayed.</p>{{ else }}
14
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
15
<span class="{{ $code_number_style }}" style="min-width: {{$tot_chars}}ch;">{{ add $idx 1 }}</span>
16
<span class="whitespace-pre">{{ $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}}
17
{{ end }}
18