forked from
tangled.org/core
Monorepo for Tangled — https://tangled.org
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 {{ if .RenderToggle }}
47 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
48 <a
49 href="/{{ .RepoInfo.FullName }}/blob/{{ .Ref }}/{{ .Path }}?code={{ .ShowRendered }}"
50 hx-boost="true"
51 >view {{ if .ShowRendered }}code{{ else }}rendered{{ end }}</a>
52 {{ end }}
53 </div>
54 </div>
55 </div>
56 {{ if .IsBinary }}
57 <p class="text-center text-gray-400 dark:text-gray-500">
58 This is a binary file and will not be displayed.
59 </p>
60 {{ else }}
61 <div class="overflow-auto relative">
62 {{ if .ShowRendered }}
63 <div id="blob-contents" class="prose dark:prose-invert">{{ .RenderedContents }}</div>
64 {{ else }}
65 <div id="blob-contents" class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ $.Contents | escapeHtml }}</div>
66 {{ end }}
67 </div>
68 {{ end }}
69{{ end }}