1{{ define "title" }}{{ .Path }} at {{ .Ref }} · {{ .RepoInfo.FullName }}{{ end }}
2
3
4{{ define "extrameta" }}
5 <meta name="vcs:clone" content="https://tangled.sh/{{ .RepoInfo.FullName }}"/>
6 <meta name="forge:summary" content="https://tangled.sh/{{ .RepoInfo.FullName }}">
7 <meta name="forge:dir" content="https://tangled.sh/{{ .RepoInfo.FullName }}/tree/{ref}/{path}">
8 <meta name="forge:file" content="https://tangled.sh/{{ .RepoInfo.FullName }}/blob/{ref}/{path}">
9 <meta name="forge:line" content="https://tangled.sh/{{ .RepoInfo.FullName }}/blob/{ref}/{path}#L{line}">
10 <meta name="go-import" content="tangled.sh/{{ .RepoInfo.FullNameWithoutAt }} git https://tangled.sh/{{ .RepoInfo.FullName }}">
11{{ end }}
12
13
14{{ define "repoContent" }}
15 {{ $lines := split .Contents }}
16 {{ $tot_lines := len $lines }}
17 {{ $tot_chars := len (printf "%d" $tot_lines) }}
18 {{ $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" }}
19 {{ $linkstyle := "no-underline hover:underline" }}
20 <div class="pb-2 mb-3 text-base border-b border-gray-200 dark:border-gray-700">
21 <div class="flex flex-col md:flex-row md:justify-between gap-2">
22 <div id="breadcrumbs" class="overflow-x-auto whitespace-nowrap text-gray-400 dark:text-gray-500">
23 {{ range $idx, $value := .BreadCrumbs }}
24 {{ if ne $idx (sub (len $.BreadCrumbs) 1) }}
25 <a
26 href="{{ index . 1 }}"
27 class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}"
28 >{{ index . 0 }}</a
29 >
30 /
31 {{ else }}
32 <span class="text-bold text-black dark:text-white"
33 >{{ index . 0 }}</span
34 >
35 {{ end }}
36 {{ end }}
37 </div>
38 <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">
39 <span>at <a href="/{{ .RepoInfo.FullName }}/tree/{{ .Ref }}">{{ .Ref }}</a></span>
40 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
41 <span>{{ .Lines }} lines</span>
42 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
43 <span>{{ byteFmt .SizeHint }}</span>
44 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
45 <a href="/{{ .RepoInfo.FullName }}/blob/{{ .Ref }}/raw/{{ .Path }}">view raw</a>
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 </div>
52 </div>
53 </div>
54 {{ if .IsBinary }}
55 <p class="text-center text-gray-400 dark:text-gray-500">
56 This is a binary file and will not be displayed.
57 </p>
58 {{ else }}
59 <div class="overflow-auto relative">
60 {{ if .ShowRendered }}
61 <div id="blob-contents" class="prose dark:prose-invert p-6">{{ .RenderedContents }}</div>
62 {{ else }}
63 <div id="blob-contents" class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ $.Contents | escapeHtml }}</div>
64 {{ end }}
65 </div>
66 {{ end }}
67{{ end }}