Skip to content

Commit

Permalink
Implement stub columns
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman committed Apr 4, 2024
1 parent 95747dc commit d3cea2a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions layouts/shortcodes/tomlToTable.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
widths = ["10%", "50%", "20%"]
headerrows = 1
footer-rows = 3
stub-columns = 1
stubcolumns = 1

[[row]]
column = [
Expand Down Expand Up @@ -61,7 +61,9 @@
{{ if (modBool $row_idx 2) }}<tr class="row-odd">{{- else }}<tr class="row-even">{{- end }}
{{- range $col_idx, $col := $row.column }}
{{- $alignment := or (index $align $col_idx) "left" }}
<th class="head" style="text-align:{{ $alignment }}">
{{- $isStub := compare.Lt $col_idx $data.stubcolumns }}
{{- $class := cond $isStub "head stub" "head" }}
<th class="{{ $class }}" style="text-align:{{ $alignment }}">
{{ $col | markdownify }}
</th>
{{- end }}
Expand All @@ -74,9 +76,14 @@
{{ if (modBool (add $row_idx $headerrows) 2) }}<tr class="row-odd">{{- else }}<tr class="row-even">{{- end }}
{{- range $col_idx, $col := $row.column }}
{{- $alignment := or (index $align $col_idx) "left" }}
<td class="head" style="text-align:{{ $alignment }}">
{{- $isStub := compare.Lt $col_idx $data.stubcolumns }}
{{- if $isStub }}
<th class="stub" style="text-align:{{ $alignment }}">
{{- else }}
<td style="text-align:{{ $alignment }}">
{{- end }}
{{ $col | markdownify }}
</td>
{{ cond $isStub "</th>" "</td>" | safeHTML }}
{{- end }}
</tr>
{{- end }}
Expand Down

0 comments on commit d3cea2a

Please sign in to comment.