Skip to content

Commit a3635a0

Browse files
Merge branch 'main' into partial-decorators
2 parents a4a2245 + 974d6ac commit a3635a0

4 files changed

Lines changed: 94 additions & 4 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
args: [--prose-wrap=preserve]
2727

2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: 45ef068da5f21267bb2a7ec4a623092959f09ce5 # frozen: v0.14.14
29+
rev: c60c980e561ed3e73101667fe8365c609d19a438 # frozen: v0.15.9
3030
hooks:
3131
- id: ruff
3232
args:
@@ -39,7 +39,7 @@ repos:
3939
- id: ruff-format
4040

4141
- repo: https://github.com/woodruffw/zizmor-pre-commit
42-
rev: b546b77c44c466a54a42af5499dcc0dcc1a3193f # frozen: v1.22.0
42+
rev: ea2eb407b4cbce87cf0d502f36578950494f5ac9 # frozen: v1.23.1
4343
hooks:
4444
- id: zizmor
4545

layouts/partials/_elements/grid.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{- $outline := default "false" .outline -}}
22
{{- $columns := default "auto" .columns -}}
3+
{{- $gutter := default "2" .gutter -}}
34
{{- $items := .items -}}
45
{{- if eq $outline "true" -}}
56
{{- $outline = "sd-border-1" -}}
@@ -13,7 +14,19 @@
1314
{{- $sm := index $columns 1 }}
1415
{{- $md := index $columns 2 }}
1516
{{- $lg := index $columns 3 }}
16-
<div class="sd-row sd-row-cols-{{ $xs }} sd-row-cols-xs-{{ $xs }} sd-row-cols-sm-{{ $sm }} sd-row-cols-md-{{ $md }} sd-row-cols-lg-{{ $lg }} sd-g-2 sd-g-xs-{{ $xs }} sd-g-sm-{{ $sm }} sd-g-md-{{ $md }} sd-g-lg-{{ $lg }}">
17+
{{- $gutterParts := split $gutter " " -}}
18+
{{- $gXs := index $gutterParts 0 -}}
19+
{{- $gSm := $gXs -}}
20+
{{- $gMd := $gXs -}}
21+
{{- $gLg := $gXs -}}
22+
{{- if and (gt (len $gutterParts) 1) (ne (len $gutterParts) 4) -}}
23+
{{- errorf "grid gutter must be either 1 or 4 values (but got %d): %q" (len $gutterParts) $gutter -}}
24+
{{- else if eq (len $gutterParts) 4 -}}
25+
{{- $gSm = index $gutterParts 1 -}}
26+
{{- $gMd = index $gutterParts 2 -}}
27+
{{- $gLg = index $gutterParts 3 -}}
28+
{{- end -}}
29+
<div class="sd-row sd-row-cols-{{ $xs }} sd-row-cols-xs-{{ $xs }} sd-row-cols-sm-{{ $sm }} sd-row-cols-md-{{ $md }} sd-row-cols-lg-{{ $lg }} sd-g-{{ $gXs }} sd-g-xs-{{ $gXs }} sd-g-sm-{{ $gSm }} sd-g-md-{{ $gMd }} sd-g-lg-{{ $gLg }}">
1730
{{- end }}
1831
{{- range $key, $item := $items -}}
1932
{{- if eq $item.type "card" }}

layouts/partials/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</a>
3737
{{- end }}
3838
</div>
39-
<div class="copyright">&copy; {{ now.Year}} {{ $author }}. All rights reserved.</div>
39+
<div class="copyright">&copy; {{ now.Year}}{{ with $author }} {{ . }}{{ end }}. All rights reserved.</div>
4040
</div>
4141
</div>
4242
</div>

layouts/shortcodes/grid.html

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,83 @@
118118

119119
{{< /grid >}}
120120

121+
Here's a grid with [gutters](https://sphinx-design.readthedocs.io/en/pydata-theme/grids.html#controlling-spacing-between-items).
122+
A single value applies to all breakpoints.
123+
124+
{{< grid columns="1 2 3 4" gutter="1" >}}
125+
126+
[[item]]
127+
type = 'card'
128+
body = 'Tight spacing'
129+
130+
[[item]]
131+
type = 'card'
132+
body = 'Tight spacing'
133+
134+
[[item]]
135+
type = 'card'
136+
body = 'Tight spacing'
137+
138+
[[item]]
139+
type = 'card'
140+
body = 'Tight spacing'
141+
142+
{{< /grid >}}
143+
144+
Here's a grid with no gutters, which means no spacing between items.
145+
146+
{{< grid columns="2 2 2 2" gutter="0" >}}
147+
148+
[[item]]
149+
type = 'card'
150+
body = 'No spacing'
151+
152+
[[item]]
153+
type = 'card'
154+
body = 'No spacing'
155+
156+
{{< /grid >}}
157+
158+
Here's a grid with responsive gutters (i.e., "xs sm md lg" are set).
159+
160+
{{< grid columns="1 2 2 3" gutter="1 1 3 4" >}}
161+
162+
[[item]]
163+
type = 'card'
164+
body = 'Responsive gutter: 0.25rem on mobile, 1rem on tablet, 1.5rem on desktop'
165+
166+
[[item]]
167+
type = 'card'
168+
body = 'Responsive gutter: 0.25rem on mobile, 1rem on tablet, 1.5rem on desktop'
169+
170+
[[item]]
171+
type = 'card'
172+
body = 'Responsive gutter: 0.25rem on mobile, 1rem on tablet, 1.5rem on desktop'
173+
174+
{{< /grid >}}
175+
176+
And here's a grid with a large gutter, for more spacious layouts.
177+
178+
{{< grid columns="2 2 2 2" gutter="5" >}}
179+
180+
[[item]]
181+
type = 'card'
182+
body = 'Large spacing (3rem)'
183+
184+
[[item]]
185+
type = 'card'
186+
body = 'Large spacing (3rem)'
187+
188+
{{< /grid >}}
189+
190+
The parameters are based on sphinx-design system grid utilities, which is in-turn based on Bootstrap grid system. They are as follows:
191+
- 0: 0 (no spacing)
192+
- 1: 0.25rem
193+
- 2: 0.5rem (default)
194+
- 3: 1rem
195+
- 4: 1.5rem
196+
- 5: 3rem
197+
121198
*/}}
122199

123200
{{- $items := "" -}}

0 commit comments

Comments
 (0)