33 lines
1.4 kB
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
{{ $linkstyle := "no-underline hover:underline" }}
7
<div class="pb-2 text-base">
8
<div class="flex justify-between">
9
<div id="breadcrumbs">
10
{{ range $idx, $value := .BreadCrumbs }}
11
{{ if ne $idx (sub (len $.BreadCrumbs) 1) }}
12
<a href="{{ index . 1}}" class="text-bold text-gray-500 {{ $linkstyle }}">{{ index . 0 }}</a> /
13
{{ else }}
14
<span class="text-bold text-gray-500">{{ index . 0 }}</span>
15
{{ end }}
16
{{ end }}
17
</div>
18
<div id="file-info">
19
<span class="text-gray-500 text-xs">
20
{{ .Lines }} lines
21
·
22
{{ byteFmt .SizeHint }}
23
</span>
24
</div>
25
</div>
26
</div>
27
28
29
{{ if .IsBinary }}<p class="text-center text-gray-400">This is a binary file and will not be displayed.</p>{{ else }}
30
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
31
<span class="{{ $code_number_style }}" style="min-width: {{$tot_chars}}ch;">{{ add $idx 1 }}</span>
32
<span class="whitespace-pre">{{ escapeHtml $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}}
33
{{ end }}
34