50 lines
2.0 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-6 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
13
href="{{ index . 1 }}"
14
class="text-bold text-gray-500 {{ $linkstyle }}"
15
>{{ index . 0 }}</a
16
>
17
/
18
{{ else }}
19
<span class="text-bold text-gray-500"
20
>{{ index . 0 }}</span
21
>
22
{{ end }}
23
{{ end }}
24
</div>
25
<div id="file-info" class="text-gray-500 text-xs">
26
{{ .Lines }} lines
27
<span class="select-none px-2 [&:before]:content-['·']"></span>
28
{{ byteFmt .SizeHint }}
29
</div>
30
</div>
31
</div>
32
{{ if .IsBinary }}
33
<p class="text-center text-gray-400">
34
This is a binary file and will not be displayed.
35
</p>
36
{{ else }}
37
<div class="overflow-auto relative text-ellipsis">
38
{{ range $idx, $line := $lines }}
39
<div class="flex">
40
<span
41
class="{{ $code_number_style }}"
42
style="min-width: {{ $tot_chars }}ch;"
43
>{{ add $idx 1 }}</span
44
>
45
<div class="whitespace-pre">{{ $line | escapeHtml }}</div>
46
</div>
47
{{ end }}
48
</div>
49
{{ end }}
50
{{ end }}
51