diff --git a/layouts/shortcodes/csv-table.html b/layouts/shortcodes/csv-table.html new file mode 100644 index 0000000000000000000000000000000000000000..69c187f40417439d7db4b18bd5d4864c4def6541 --- /dev/null +++ b/layouts/shortcodes/csv-table.html @@ -0,0 +1,29 @@ +{{ $caption := .Get "caption" }} +{{ $useHeaderRow := .Get "header" }} +{{ $rows := .Inner | transform.Unmarshal }} + + + +<div class="custom-table-1" > +<table class="sortable"> + {{ with $caption }}<caption>{{ . }}</caption>{{ end }} + {{ if $useHeaderRow }} + {{ $headerRow := index $rows 0 }} + {{ $rows = after 1 $rows }} + <thead><tr> {{ range $headerRow }} <th>{{ . }}</th> {{ end }} </tr></thead> + {{ end }} + {{ range $rows }} + <tr> + {{ range . }} + {{ if (findRE "^\\d+$" .) }} + <td class="numeric">{{ . }}</td> + {{ else }} + <td>{{ . }}</td> + {{ end }} + {{ end }} + </tr> + {{ end }} +</table> +</div> + +