From 91d08a141b17cc509e07ebeaa02d986b0d20fce6 Mon Sep 17 00:00:00 2001 From: Paul Duncan <pabs@pablotron.org> Date: Fri, 22 Oct 2021 02:38:58 -0400 Subject: themes/hugo-pt2021/layout/shortcodes/table.html: fix column header alignment --- themes/hugo-pt2021/layouts/shortcodes/table.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'themes') diff --git a/themes/hugo-pt2021/layouts/shortcodes/table.html b/themes/hugo-pt2021/layouts/shortcodes/table.html index 907ef44..7fa30cc 100644 --- a/themes/hugo-pt2021/layouts/shortcodes/table.html +++ b/themes/hugo-pt2021/layouts/shortcodes/table.html @@ -148,7 +148,23 @@ you can override the `class` attribute for individual cells. <thead> <tr> {{- range $x, $col := $table.cols -}} + {{/* set default css */}} + {{- $css := "" -}} + + {{/* get alignment */}} + {{- $align := default "" $col.align -}} + {{- if eq $align "left" -}} + {{- $css = $config.cell_align_left -}} + {{- else if eq $align "center" -}} + {{- $css = $config.cell_align_center -}} + {{- else if eq $align "justified" -}} + {{- $css = $config.cell_align_justified -}} + {{- else if eq $align "right" -}} + {{- $css = $config.cell_align_right -}} + {{- end -}} + <th + {{if $css}} class='{{- $css -}}'{{- end}} title='{{- default $col.name $col.tip -}}' aria-label='{{- default $col.name $col.tip -}}' data-{{- $dp -}}th_x='{{- $x -}}' -- cgit v1.2.3