From 2cbf39cf7302b5f8907fb876c556b2d1600cc341 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 25 Oct 2021 15:37:25 -0400 Subject: hugo-pt2021/layouts/shortcodes/table.html: simplify config names, add comments --- themes/hugo-pt2021/layouts/shortcodes/table.html | 37 +++++++++++++++--------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'themes/hugo-pt2021/layouts/shortcodes') diff --git a/themes/hugo-pt2021/layouts/shortcodes/table.html b/themes/hugo-pt2021/layouts/shortcodes/table.html index ec511bd..7d46834 100644 --- a/themes/hugo-pt2021/layouts/shortcodes/table.html +++ b/themes/hugo-pt2021/layouts/shortcodes/table.html @@ -55,7 +55,7 @@ the search config path is: */}} {{/* set default config */}} -{{- $config := (dict "data_prefix" "" "table_base_css" "table" "cell_align_left" "has-text-left" "cell_align_center" "has-text-centered" "cell_align_justify" "has-text-justified" "cell_align_right" "has-text-right") -}} +{{- $config := (dict "data_prefix" "" "table_class" "table" "align_left" "has-text-left" "align_center" "has-text-centered" "align_justify" "has-text-justified" "align_right" "has-text-right") -}} {{- if index $.Page.Params "table_config" -}} {{/* use table config from page front matter */}} {{- $config = $.Params.table_shortcode -}} @@ -83,7 +83,7 @@ the search config path is: {{- $table = (dict "cols" (index $table 0) "rows" (last (sub (len $table) 1) $table)) -}} {{- end -}} -{{- if (index $table "config") -}} +{{- if index $table "config" -}} {{/* use config from table */}} {{- $config = $table.config -}} {{- end -}} @@ -93,7 +93,7 @@ the search config path is: {{- if $table.id -}}id='{{- $table.id -}}'{{- end -}} {{/* base (e.g. "table" in bulma) and custom CSS class for table */}} - class='{{- $config.table_base_css }} {{ default "" $table.css -}}' + class='{{- $config.table_class }} {{ default "" $table.css -}}' {{/* table tooltip and ARIA label */}} title='{{- default $table.name $table.tip -}}' @@ -119,13 +119,13 @@ the search config path is: {{/* get alignment */}} {{- $align := default "" $col.align -}} {{- if eq $align "left" -}} - {{- $css = $config.cell_align_left -}} + {{- $css = $config.align_left -}} {{- else if eq $align "center" -}} - {{- $css = $config.cell_align_center -}} + {{- $css = $config.align_center -}} {{- else if eq $align "justified" -}} - {{- $css = $config.cell_align_justify -}} + {{- $css = $config.align_justify -}} {{- else if eq $align "right" -}} - {{- $css = $config.cell_align_right -}} + {{- $css = $config.align_right -}} {{- end -}} {{- range $x, $col := $table.cols -}} {{- index $row $x -}} -- cgit v1.2.3