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

16 lines
476 B
HTML
Raw Normal View History

2021-12-12 09:44:31 +08:00
{{ $caption := .Get "caption" }}
2021-12-13 03:51:57 +08:00
{{ $useHeaderRow := .Get "header" | default true }}
2021-12-12 09:44:31 +08:00
{{ $rows := .Inner | transform.Unmarshal }}
<table class="csv-table">
2021-12-13 03:51:57 +08:00
{{ with $caption }}<caption>{{- . -}}</caption>{{ end }}
{{ if $useHeaderRow -}}
<thead><tr>{{ range (index $rows 0) }}<th>{{- . -}}</th>{{ end }}</tr></thead>
2021-12-13 04:46:41 +08:00
{{- $rows = after 1 $rows -}}
2021-12-12 09:44:31 +08:00
{{ end -}}
<tbody>
{{ range $rows -}}
2021-12-24 08:31:19 +08:00
<tr>{{ range . }}<td>{{- . | markdownify -}}</td>{{ end }}</tr>
2021-12-12 09:44:31 +08:00
{{ end -}}
</tbody>
</table>