~emersion/gyosu

ref: a0632ccc8a732511be40505afd5993f096841a29 gyosu/template/unit.html -rw-r--r-- 1.0 KiB
a0632cccSimon Ser template/unit: add table of contents a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{{ template "head.html" . }}

<main>
	<h2>{{ .Title }}</h2>

	<p>
		<a href="{{ .IndexHref }}">Back to index</a>
	</p>

	<details open>
		<summary>Table of contents</summary>

		<ul>
			{{ range .Decls }}
				<li>
					<a href="#{{ .Kind }}-{{ .Name }}">{{ .Title }}</a>
				</li>
			{{ end }}
		<ul>
	</details>

	{{ range .Decls }}
	<section class="{{ .Kind }}">
			<h3 id="{{ .Kind }}-{{ .Name }}">
				{{ .Title }}
				<a href="#{{ .Kind }}-{{ .Name }}"></a>
			</h3>
			<pre class="prototype">
				{{- range .Prototype -}}
					{{- $tok := . -}}
					{{- if eq .Type.String "symbol" -}}
						{{- with symhref .Kind .Value -}}
							<a href="{{ . }}" class="token-symbol">{{ $tok.Value }}</a>
						{{- else -}}
							<span class="token-symbol">{{ $tok.Value }}</span>
						{{- end -}}
					{{- else -}}
						<span class="token-{{ $tok.Type }}">{{ $tok.Value }}</span>
					{{- end -}}
				{{- end -}}
			</pre>
			{{ range .Description }}
				<p>{{ . }}</p>
			{{ end }}
		</section>
	{{ end }}
</main>

{{ template "foot.html" }}