Debian Codegraph @

docs/layouts/_shortcodes/datatable.html

raw
1 {{ $package := (index .Params 0) }}
2 {{ $listname := (index .Params 1) }}
3 {{ $list := (index (index hugo.Data.docs $package) $listname) }}
4 {{ $fields := after 2 .Params }}
5
6 <div class="overflow-x-auto">
7 <table>
8 <thead>
9 <tr>
10 {{ range $fields }}
11 {{ $s := . }}
12 {{ if eq $s "_key" }}
13 {{ $s = "type" }}
14 {{ end }}
15 <th>{{ $s }}</th>
16 {{ end }}
17 </tr>
18 </thead>
19 <tbody>
20 {{ range $k1, $v1 := $list }}
21 <tr>
22 {{ range $k2, $v2 := . }}
23 {{ $.Scratch.Set $k2 $v2 }}
24 {{ end }}
25 {{ range $fields }}
26 {{ $s := "" }}
27 {{ if eq . "_key" }}
28 {{ $s = $k1 }}
29 {{ else }}
30 {{ $s = $.Scratch.Get . }}
31 {{ end }}
32 <td>{{ $s }}</td>
33 {{ end }}
34 </tr>
35 {{ end }}
36 </tbody>
37 </table>
38 </div>