Add number, numbered shortcode params

This commit is contained in:
Will Faught
2023-01-19 21:46:07 -08:00
parent d718943648
commit 025935f6bd
10 changed files with 80 additions and 5 deletions

View File

@@ -7,6 +7,8 @@
{{ $maxheight := .Get "maxheight" }}
{{ $maxwidth := .Get "maxwidth" }}
{{ $method := .Get "method" | default "resize" }}
{{ $number := .Get "number" }}
{{ $numbered := .Get "numbered" }}
{{ $options := .Get "options" | default "550x webp picture Lanczos" }}
{{ $raw := .Get "raw" }}
{{ $type := .Get "type" | default "rows" }}
@@ -61,6 +63,7 @@
{{ else }}
{{ $inner := chomp .Inner }}
{{ $resources := slice }}
{{ $showcaption := $caption }}
{{ with $images }}
{{ with $.Page.Resources.Match . }}
@@ -76,6 +79,19 @@
{{ end }}
{{ end }}
{{ if $caption }}
{{ if $number }}
{{ $caption = printf "%v %v: %v" (i18n "paige_figure") $number $caption }}
{{ end }}
{{ else }}
{{ if $number }}
{{ $caption = printf "%v %v" (i18n "paige_figure") $number }}
{{ $showcaption = true }}
{{ else if $numbered }}
{{ $showcaption = true }}
{{ end }}
{{ end }}
<figure>
{{ if eq $type "grid" }}
<div class="container-fluid px-0">
@@ -128,8 +144,8 @@
{{ else }}
{{ errorf "invalid type: %q" $type }}
{{ end }}
{{ with $caption }}
<figcaption class="figure-caption mt-2 text-center">{{ . }}</figcaption>
{{ if $showcaption }}
<figcaption class="figure-caption mt-2 text-center">{{ $caption }}</figcaption>
{{ end }}
</figure>
{{ end }}