1{{ define "title" }}{{ .Path }} at {{ .Ref }} · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ template "repo/fragments/meta" . }}
5
6 {{ $title := printf "%s at %s · %s" .Path .Ref .RepoInfo.FullName }}
7 {{ $url := printf "https://tangled.sh/%s/blob/%s/%s" .RepoInfo.FullName .Ref .Path }}
8
9 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
10
11{{ end }}
12
13{{ define "repoContent" }}
14 {{ $lines := split .Contents }}
15 {{ $tot_lines := len $lines }}
16 {{ $tot_chars := len (printf "%d" $tot_lines) }}
17 {{ $code_number_style := "text-gray-400 dark:text-gray-500 left-0 bg-white dark:bg-gray-800 text-right mr-6 select-none inline-block w-12" }}
18 {{ $linkstyle := "no-underline hover:underline" }}
19 <div class="pb-2 mb-3 text-base border-b border-gray-200 dark:border-gray-700">
20 <div class="flex flex-col md:flex-row md:justify-between gap-2">
21 <div id="breadcrumbs" class="overflow-x-auto whitespace-nowrap text-gray-400 dark:text-gray-500">
22 {{ range $idx, $value := .BreadCrumbs }}
23 {{ if ne $idx (sub (len $.BreadCrumbs) 1) }}
24 <a
25 href="{{ index . 1 }}"
26 class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}"
27 >{{ index . 0 }}</a
28 >
29 /
30 {{ else }}
31 <span class="text-bold text-black dark:text-white"
32 >{{ index . 0 }}</span
33 >
34 {{ end }}
35 {{ end }}
36 </div>
37 <div id="file-info" class="text-gray-500 dark:text-gray-400 text-xs md:text-sm flex flex-wrap items-center gap-1 md:gap-0">
38 <span>at <a href="/{{ .RepoInfo.FullName }}/tree/{{ .Ref }}">{{ .Ref }}</a></span>
39 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
40 <span>{{ .Lines }} lines</span>
41 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
42 <span>{{ byteFmt .SizeHint }}</span>
43 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
44 <a href="/{{ .RepoInfo.FullName }}/raw/{{ .Ref }}/{{ .Path }}">view raw</a>
45 {{ if .RenderToggle }}
46 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
47 <a
48 href="/{{ .RepoInfo.FullName }}/blob/{{ .Ref }}/{{ .Path }}?code={{ .ShowRendered }}"
49 hx-boost="true"
50 >view {{ if .ShowRendered }}code{{ else }}rendered{{ end }}</a>
51 {{ end }}
52 </div>
53 </div>
54 </div>
55 {{ if .IsBinary }}
56 <p class="text-center text-gray-400 dark:text-gray-500">
57 This is a binary file and will not be displayed.
58 </p>
59 {{ else }}
60 <div class="overflow-auto relative">
61 {{ if .ShowRendered }}
62 <div id="blob-contents" class="prose dark:prose-invert">{{ .RenderedContents }}</div>
63 {{ else }}
64 <div id="blob-contents" class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ $.Contents | escapeHtml }}</div>
65 {{ end }}
66 </div>
67 {{ end }}
68{{ end }}