Skip to content

Commit

Permalink
Simplify toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman committed Apr 4, 2024
1 parent b7e2d94 commit 95747dc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 55 deletions.
36 changes: 15 additions & 21 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,25 @@
{{< tomlToTable >}}

[[row]]
type = 'header'

[[row.column]]
body = 'Project'

[[row.column]]
body = 'Available Packages'
column = [
"Project",
"Available Packages",
"Download location"
]

[[row]]

[[row.column]]
body = 'NumPy'

[[row.column]]
body = '''Official *source code* (all platforms) and *binaries* for<br />
**Windows**, **Linux**, and **Mac OS X**'''
column = [
"NumPy",
"Official *source code* (all platforms) and *binaries* for<br/>\n**Windows**, **Linux**, and **Mac OS X**\n",
"[PyPi page for NumPy](https://pypi.python.org/pypi/numpy)"
]

[[row]]

[[row.column]]
body = 'SciPy'

[[row.column]]
body = '''Official *source code* (all platforms) and *binaries* for<br />
**Windows**, **Linux**, and **Mac OS X**'''
column = [
"SciPy",
"Official *source code* (all platforms) and *binaries* for<br/>\n**Windows**, **Linux** and **Mac OS X**\n",
"[SciPy release page](https://github.com/scipy/scipy/releases) (sources)<br/>\n[PyPI page for SciPy](https://pypi.python.org/pypi/scipy) (all)\n"
]

{{< /tomlToTable >}}

Expand Down
53 changes: 19 additions & 34 deletions layouts/shortcodes/tomlToTable.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,25 @@
stub-columns = 1

[[row]]

[[row.column]]
body = 'Project'

[[row.column]]
body = 'Available Packages'

[[row.column]]
body = 'Download location'
column = [
"Project",
"Available Packages",
"Download location"
]

[[row]]

[[row.column]]
body = 'NumPy'

[[row.column]]
body = '''Official *source code* (all platforms) and *binaries* for<br />
**Windows**, **Linux**, and **Mac OS X**'''

[[row.column]]
body = '[PyPi page for NumPy](https://pypi.python.org/pypi/numpy)'
column = [
"NumPy",
"Official *source code* (all platforms) and *binaries* for<br/>\n**Windows**, **Linux**, and **Mac OS X**\n",
"[PyPi page for NumPy](https://pypi.python.org/pypi/numpy)"
]

[[row]]

[[row.column]]
body = 'SciPy'

[[row.column]]
body = '''Official *source code* (all platforms) and *binaries* for<br />
**Windows**, **Linux**, and **Mac OS X**'''

[[row.column]]
body = '''[SciPy release page](https://github.com/scipy/scipy/releases) (sources)<br />
[PyPI page for SciPy](https://pypi.python.org/pypi/scipy) (all)'''
column = [
"SciPy",
"Official *source code* (all platforms) and *binaries* for<br/>\n**Windows**, **Linux** and **Mac OS X**\n",
"[SciPy release page](https://github.com/scipy/scipy/releases) (sources)<br/>\n[PyPI page for SciPy](https://pypi.python.org/pypi/scipy) (all)\n"
]

{{< /tomlToTable >}}

Expand Down Expand Up @@ -74,10 +59,10 @@
{{- if $header }}<thead>
{{- range $row_idx, $row := $header }}
{{ if (modBool $row_idx 2) }}<tr class="row-odd">{{- else }}<tr class="row-even">{{- end }}
{{- range $col_idx, $col := .column }}
{{- range $col_idx, $col := $row.column }}
{{- $alignment := or (index $align $col_idx) "left" }}
<th class="head" style="text-align:{{ $alignment }}">
{{ $col.body | markdownify }}
{{ $col | markdownify }}
</th>
{{- end }}
</tr>
Expand All @@ -87,10 +72,10 @@
<tbody>
{{- range $row_idx, $row := $body }}
{{ if (modBool (add $row_idx $headerrows) 2) }}<tr class="row-odd">{{- else }}<tr class="row-even">{{- end }}
{{- range $col_idx, $col := .column }}
{{- range $col_idx, $col := $row.column }}
{{- $alignment := or (index $align $col_idx) "left" }}
<td class="head" style="text-align:{{ $alignment }}">
{{ $col.body | markdownify }}
{{ $col | markdownify }}
</td>
{{- end }}
</tr>
Expand Down

0 comments on commit 95747dc

Please sign in to comment.