hugo/layouts/shortcodes/datatable-vertical.html
Bjørn Erik Pedersen dd78d5b23f Squashed 'docs/' content from commit 5d9a6703
git-subtree-dir: docs
git-subtree-split: 5d9a6703591c29283800d7b9e4c5c85981ed86d6
2017-06-26 20:46:06 +02:00

26 lines
No EOL
553 B
HTML

{{ $package := (index .Params 0) }}
{{ $listname := (index .Params 1) }}
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 2 .Params }}
<table class="table table-bordered">
{{ range $list }}
{{ range $k, $v := . }}
{{ $.Scratch.Set $k $v }}
{{ end }}
{{ end }}
{{ range $i, $_ := $fields }}
<tr>
{{ $.Scratch.Set "i" $i }}
{{ $field := (index $fields ($.Scratch.Get "i") ) }}
<th>{{ $field }}</th>
{{ range $list }}
<td>
{{ index . $field }}
</td>
{{ end }}
</tr>
{{ end }}
</table>