1{{ define "title"}}{{ range .BreadCrumbs }}{{ pathUnescape (index . 0)}}/{{ end }} at {{ .Ref }} · {{ .RepoInfo.FullName }}{{ end }}
2
3
4{{ define "extrameta" }}
5
6 {{ $path := "" }}
7 {{ range .BreadCrumbs }}
8 {{ $path = printf "%s/%s" $path (index . 0) }}
9 {{ end }}
10
11 {{ template "repo/fragments/meta" . }}
12 {{ $title := printf "%s at %s · %s" $path .Ref .RepoInfo.FullName }}
13 {{ $url := printf "https://tangled.org/%s/tree/%s%s" .RepoInfo.FullName .Ref $path }}
14
15 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
16{{ end }}
17
18
19{{define "repoContent"}}
20<main>
21 <div class="tree">
22 {{ $linkstyle := "no-underline hover:underline" }}
23
24 <div class="pb-2 mb-3 text-base border-b border-gray-200 dark:border-gray-700">
25 <div class="flex flex-col md:flex-row md:justify-between gap-2">
26 <div id="breadcrumbs" class="overflow-x-auto whitespace-nowrap text-gray-400 dark:text-gray-500">
27 {{ range .BreadCrumbs }}
28 <a href="{{ index . 1 }}" class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}">{{ pathUnescape (index . 0) }}</a> /
29 {{ end }}
30 </div>
31 <div id="dir-info" class="text-gray-500 dark:text-gray-400 text-xs md:text-sm flex flex-wrap items-center gap-1 md:gap-0">
32 {{ $stats := .TreeStats }}
33
34 <span>at <a href="/{{ $.RepoInfo.FullName }}/tree/{{ pathEscape $.Ref }}">{{ $.Ref }}</a></span>
35 {{ if eq $stats.NumFolders 1 }}
36 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
37 <span>{{ $stats.NumFolders }} folder</span>
38 {{ else if gt $stats.NumFolders 1 }}
39 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
40 <span>{{ $stats.NumFolders }} folders</span>
41 {{ end }}
42
43 {{ if eq $stats.NumFiles 1 }}
44 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
45 <span>{{ $stats.NumFiles }} file</span>
46 {{ else if gt $stats.NumFiles 1 }}
47 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
48 <span>{{ $stats.NumFiles }} files</span>
49 {{ end }}
50
51 </div>
52 </div>
53 </div>
54
55 {{ range .Files }}
56 <div class="grid grid-cols-12 gap-4 items-center py-1">
57 <div class="col-span-8 md:col-span-4">
58 {{ $link := printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "tree" (pathEscape $.Ref) $.TreePath .Name }}
59 {{ $icon := "folder" }}
60 {{ $iconStyle := "size-4 fill-current" }}
61
62 {{ if .IsSubmodule }}
63 {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.TreePath .Name }}
64 {{ $icon = "folder-input" }}
65 {{ $iconStyle = "size-4" }}
66 {{ end }}
67
68 {{ if .IsFile }}
69 {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.TreePath .Name }}
70 {{ $icon = "file" }}
71 {{ $iconStyle = "size-4" }}
72 {{ end }}
73
74 <a href="{{ $link }}" class="{{ $linkstyle }}">
75 <div class="flex items-center gap-2">
76 {{ i $icon $iconStyle "flex-shrink-0" }}
77 <span class="truncate">{{ .Name }}</span>
78 </div>
79 </a>
80 </div>
81
82 <div class="col-span-0 md:col-span-6 hidden md:block overflow-hidden">
83 {{ with .LastCommit }}
84 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400 block truncate">{{ .Message }}</a>
85 {{ end }}
86 </div>
87
88 <div class="col-span-4 md:col-span-2 text-sm text-right">
89 {{ with .LastCommit }}
90 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .When }}</a>
91 {{ end }}
92 </div>
93 </div>
94 {{ end }}
95
96 </div>
97</main>
98{{end}}
99
100{{ define "repoAfter" }}
101 {{- if or .HTMLReadme .Readme -}}
102 {{ template "repo/fragments/readme" . }}
103 {{- end -}}
104{{ end }}