Skip to content

Instantly share code, notes, and snippets.

@fieldingtron
Created May 23, 2019 19:50
Show Gist options
  • Save fieldingtron/1530c23a21df29052e2afac26d9af09d to your computer and use it in GitHub Desktop.
Save fieldingtron/1530c23a21df29052e2afac26d9af09d to your computer and use it in GitHub Desktop.
{{$tablename:="table"}} {{ (printf "%s%s" "$.Page.Params." $tablename) }}
<table class=" rtable"> table table-striped table-sm
{{$count :=0}}
{{$colname := slice }}
{{ $.Page.Params}}
{{ range $.Page.Params.table }}
{{ if eq $count 0}}
<thead>
{{ range . }}
{{ $colname = $colname | append . }}
<th>{{.}}</th>
{{ end }}
</thead><tbody>
{{ else }}
<tr>
{{$colcount :=0}}
{{ range . }}
<td data-title='{{index $colname $colcount}}'> {{.}}</td>
{{ $colcount = (add $colcount 1) }}
{{ end }}
</tr>
{{ end }}
{{ $count = (add $count 1) }}
{{end}}
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment