1<!DOCTYPE html>
2<html lang="en">
3 {{- $base := (relIndex .CurrentFile) -}}
4 <head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width,initial-scale=1">
7 {{ if (isIndexPage .) }}
8 <title>{{ .Title }}{{ if .Description }} - {{ .Description }}{{ end }}</title>
9 {{ else }}
10 <title>{{ .Title }} - {{ .CurrentFile.Name }}</title>
11 {{ end }}
12
13 <link rel="stylesheet" href="{{ $base }}style.css">
14 <script>
15 function highlight() {
16 Array.from(document.getElementsByClassName('highlighted'))
17 .forEach((e) => { e.classList.remove('highlighted') })
18
19 const pattern = /^#L([0-9]+)-L?([0-9]+)$/
20 const matches = window.location.hash.match(pattern)
21 if (!matches || matches.length != 3)
22 return
23
24 const start = parseInt(matches[1], 10)
25 const end = parseInt(matches[2], 10)
26 if (start > end || start <= 0)
27 return
28
29 var line
30 for (let i = end; i >= start; i--) {
31 line = document.getElementById('L' + i)
32 if (line == null)
33 return
34 line.classList.add('highlighted')
35 }
36 line.scrollIntoView();
37 }
38 window.addEventListener('hashchange', highlight)
39 window.addEventListener('DOMContentLoaded', (event) => highlight())
40 </script>
41 </head>
42 <body>
43 <header>
44 <h1><a href="{{ $base }}index.html">{{ .Title }}</a></h1>
45 {{ if .Description -}}
46 <p>{{ .Description }}</p>
47 {{- end }}
48 {{ if .URL -}}
49 <p class="clone">git clone <code>{{ .URL }}</code></p>
50 {{- end }}
51 </header>
52
53 <main>
54 {{ if (isIndexPage .) }}
55 {{ template "commits.tmpl" (.Commits) }}
56 {{ end }}
57
58 {{ if .CurrentFile.IsDir }}
59 {{ template "tree.tmpl" . }}
60 {{ else }}
61 {{ template "blob.tmpl" . }}
62 {{ end }}
63
64 {{ if .CurrentFile.IsDir }}
65 {{- $readme := (renderReadme .) -}}
66 {{ if $readme }}
67 {{ template "readme.tmpl" $readme }}
68 {{ end }}
69 {{ end }}
70 </main>
71 </body>
72</html>