MtF-wiki/layouts/shortcodes/csv-table.html

16 lines
476 B
HTML

{{ $caption := .Get "caption" }}
{{ $useHeaderRow := .Get "header" | default true }}
{{ $rows := .Inner | transform.Unmarshal }}
<table class="csv-table">
{{ with $caption }}<caption>{{- . -}}</caption>{{ end }}
{{ if $useHeaderRow -}}
<thead><tr>{{ range (index $rows 0) }}<th>{{- . -}}</th>{{ end }}</tr></thead>
{{- $rows = after 1 $rows -}}
{{ end -}}
<tbody>
{{ range $rows -}}
<tr>{{ range . }}<td>{{- . | markdownify -}}</td>{{ end }}</tr>
{{ end -}}
</tbody>
</table>