diff options
Diffstat (limited to 'themes/hugo-pt2021/layouts')
-rw-r--r-- | themes/hugo-pt2021/layouts/shortcodes/table.html | 37 |
1 files changed, 23 insertions, 14 deletions
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 -}} <th @@ -188,7 +188,7 @@ the search config path is: {{/* get cell value */}} {{- $val := "" -}} {{- if $is_map -}} - {{- $val = index $cell "val" -}} + {{- $val = index $cell.val -}} {{- else -}} {{- $val = $cell -}} {{- end -}} @@ -205,7 +205,7 @@ the search config path is: {{- $tip := (default $col.name $col.tip) -}} {{- if $is_map -}} {{- if index $cell "tip" -}} - {{- $tip = index $cell "tip" -}} + {{- $tip = $cell.tip -}} {{- end -}} {{- end -}} @@ -220,13 +220,13 @@ the search config path is: {{/* get default cell css */}} {{- $css := "" -}} {{- 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 -}} {{/* get cell css override */}} @@ -254,15 +254,19 @@ the search config path is: {{/* emit cell */}} <td - {{/* emit cell ID */}} + {{/* cell ID */}} {{- if $cell_id -}} id='{{- $cell_id -}}' {{- end -}} + {{/* cell tooltip */}} title='{{- $tip -}}' aria-label='{{- $tip -}}' + + {{/* cell class */}} class='{{- $css -}}' + {{/* cell position and ID */}} data-{{- $dp -}}td_x='{{- $x -}}' data-{{- $dp -}}td_id='{{- $col.id -}}' @@ -297,8 +301,13 @@ the search config path is: > {{- range $x, $col := $table.cols -}} <td + {{/* cell tooltip */}} title='{{- $col -}}' aria-label='{{- $col -}}' + {{/* cell tooltip */}} + + {{/* cell position */}} + data-{{- $dp -}}td_x='{{- $x -}}' > {{- index $row $x -}} </td> |