aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2021-10-22 02:38:58 -0400
committerPaul Duncan <pabs@pablotron.org>2021-10-22 02:38:58 -0400
commit91d08a141b17cc509e07ebeaa02d986b0d20fce6 (patch)
treef20251ad17d1a59d9cef2a94f03b67ad6682514c
parent90f65366f1b060fb7bbc4e59804969ae4989ab89 (diff)
downloadpablotron.org-91d08a141b17cc509e07ebeaa02d986b0d20fce6.tar.bz2
pablotron.org-91d08a141b17cc509e07ebeaa02d986b0d20fce6.zip
themes/hugo-pt2021/layout/shortcodes/table.html: fix column header alignment
-rw-r--r--themes/hugo-pt2021/layouts/shortcodes/table.html16
1 files changed, 16 insertions, 0 deletions
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 -}}'