Skip to content
Snippets Groups Projects
Verified Commit 022939cc authored by Šimon Berka's avatar Šimon Berka
Browse files

add csv-table shortcode

parent 21b910a2
No related branches found
No related tags found
No related merge requests found
{{ $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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment