File: datatable.html

package info (click to toggle)
hugo 0.155.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 43,600 kB
  • sloc: javascript: 31,879; ansic: 2,350; xml: 350; makefile: 196; sh: 110
file content (39 lines) | stat: -rw-r--r-- 915 bytes parent folder | download | duplicates (3)
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
{{ $package := (index .Params 0) }}
{{ $listname := (index .Params 1) }}
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 2 .Params }}


<div class="overflow-x-auto">
  <table>
    <thead>
      <tr>
        {{ range $fields }}
          {{ $s := . }}
          {{ if eq $s "_key" }}
            {{ $s = "type" }}
          {{ end }}
          <th>{{ $s }}</th>
        {{ end }}
      </tr>
    </thead>
    <tbody>
      {{ range $k1, $v1 := $list }}
        <tr>
          {{ range $k2, $v2 := . }}
            {{ $.Scratch.Set $k2 $v2 }}
          {{ end }}
          {{ range $fields }}
            {{ $s := "" }}
            {{ if eq . "_key" }}
              {{ $s = $k1 }}
            {{ else }}
              {{ $s = $.Scratch.Get . }}
            {{ end }}
            <td>{{ $s }}</td>
          {{ end }}
        </tr>
      {{ end }}
    </tbody>
  </table>
</div>