diff options
| author | Francesco <tomaselli.fr@gmail.com> | 2025-04-18 11:15:18 +0200 | 
|---|---|---|
| committer | Francesco <tomaselli.fr@gmail.com> | 2025-04-18 11:15:18 +0200 | 
| commit | 853fbc5cfbf07c292646fc561560cbb6d434a0df (patch) | |
| tree | 2cc6c24550f4f593f3e8ad2bd3c0531ffe1fdf70 /layouts/_default/_markup | |
| parent | 52e58abda7e2af16e47dd4fb089eac41c1220ea8 (diff) | |
Add proper table rendering
Diffstat (limited to 'layouts/_default/_markup')
| -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 | 
