Motif No. 1, copyright © 2010 Douglas Cuthbertson
Template Create Rows Head
<!-- Use only within thead elements. This will generate
<tr><th>...</th><th>...</th>...</tr> row sequences
-->
{{- define "createRowsHead" -}}
{{- $rows := . -}}
{{- range $idx, $row := $rows -}}
{{- if and (not (reflect.IsMap $row)) (not (reflect.IsSlice $row)) -}}
<!-- row value is a scalar -->
<th>{{- $row -}}</th>
{{- else if reflect.IsMap $row -}}
<!-- row value is a map -->
{{- template "processMapHead" $row -}}
{{- else if reflect.IsSlice $row}}
<!-- row value is a slice -->
{{- template "createRowsHead" $row -}}
{{- else -}}
<!-- row value type is unknown -->
{{- $idx -}} (head-row-unknown): {{- $row -}}
{{- end -}}
{{- end -}}
{{- end -}}