diff options
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/_markup/render-table.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/layouts/_default/_markup/render-table.html b/layouts/_default/_markup/render-table.html new file mode 100644 index 0000000..5534d3a --- /dev/null +++ b/layouts/_default/_markup/render-table.html @@ -0,0 +1,44 @@ +{{/* +Default table rendered plus an outer div to align and overflow tables +accordingly. +Ref: https://gohugo.io/render-hooks/tables/ +*/}} +<div class="table-outer"> + <table + {{- range $k, $v :=.Attributes }} + {{- if $v }} + {{- printf " %s=%q" $k $v | safeHTMLAttr }} + {{- end }} + {{- end }}> + <thead> + {{- range .THead }} + <tr> + {{- range . }} + <th + {{- with .Alignment }} + {{- printf " style=%q" (printf "text-align: %s" .) | + safeHTMLAttr }} + {{- end -}}> + {{- .Text -}} + </th> + {{- end }} + </tr> + {{- end }} + </thead> + <tbody> + {{- range .TBody }} + <tr> + {{- range . }} + <td + {{- with .Alignment }} + {{- printf " style=%q" (printf "text-align: %s" .) | + safeHTMLAttr }} + {{- end -}}> + {{- .Text -}} + </td> + {{- end }} + </tr> + {{- end }} + </tbody> + </table> +</div>
\ No newline at end of file |