diff --git a/layouts/partials/paige/figure.html b/layouts/partials/paige/figure.html deleted file mode 100644 index 7cb784b3..00000000 --- a/layouts/partials/paige/figure.html +++ /dev/null @@ -1,64 +0,0 @@ -{{ $params := . }} - -{{ $caption := $params.caption | markdownify }} -{{ $content := $params.content | markdownify }} -{{ $float := $params.float }} -{{ $gap := $params.gap }} -{{ $horizontal := $params.horizontal | default "center" }} -{{ $maxwidth := $params.maxwidth }} -{{ $number := $params.number }} -{{ $numbered := $params.numbered }} -{{ $vertical := $params.vertical | default "center" }} -{{ $width := $params.width }} - -{{ $showcaption := $caption }} -{{ $sidemargin := "" }} -{{ $table := false }} -{{ $widths := slice }} - -{{ if and $caption $float }} - {{ $table = true }} -{{ end }} - -{{ if $maxwidth }} - {{ $widths = $widths | append (printf "max-width: %v" $maxwidth) }} -{{ end }} - -{{ if $width }} - {{ $widths = $widths | append (printf "width: %v" $width) }} -{{ end }} - -{{ $widths = delimit ($widths | sort) "; " }} - -{{ if $float }} - {{ if eq $float "start" }} - {{ $sidemargin = "me-4" }} - {{ else if eq $float "end" }} - {{ $sidemargin = "ms-4" }} - {{ else }} - {{ errorf "paige/figure: invalid float: %q" $float }} - {{ 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 }} - -
-
-
{{ $content }}
- - {{ if $showcaption }} -
{{ $caption }}
- {{ end }} -
-
diff --git a/layouts/shortcodes/paige/figure.html b/layouts/shortcodes/paige/figure.html index 469976fb..7a4c5d7c 100644 --- a/layouts/shortcodes/paige/figure.html +++ b/layouts/shortcodes/paige/figure.html @@ -1,22 +1,61 @@ -{{ $caption := .Get 0 | default (.Get "caption") }} -{{ $content := .Inner }} +{{ $caption := .Get 0 | default (.Get "caption") | markdownify }} +{{ $content := .Inner | markdownify }} {{ $float := .Get "float" }} -{{ $horizontal := .Get "horizontal" }} +{{ $horizontal := .Get "horizontal" | default "center" }} {{ $maxwidth := .Get "maxwidth" }} {{ $number := .Get "number" }} {{ $numbered := .Get "numbered" }} -{{ $vertical := .Get "vertical" }} +{{ $vertical := .Get "vertical" | default "center" }} {{ $width := .Get "width" }} -{{ partial "paige/figure.html" (dict - "caption" $caption - "content" $content - "float" $float - "gap" 2 - "horizontal" $horizontal - "maxwidth" $maxwidth - "number" $number - "numbered" $numbered - "vertical" $vertical - "width" $width -) }} +{{ $showcaption := $caption }} +{{ $sidemargin := "" }} +{{ $table := false }} +{{ $widths := slice }} + +{{ if and $caption $float }} + {{ $table = true }} +{{ end }} + +{{ if $maxwidth }} + {{ $widths = $widths | append (printf "max-width: %v" $maxwidth) }} +{{ end }} + +{{ if $width }} + {{ $widths = $widths | append (printf "width: %v" $width) }} +{{ end }} + +{{ $widths = delimit ($widths | sort) "; " }} + +{{ if $float }} + {{ if eq $float "start" }} + {{ $sidemargin = "me-4" }} + {{ else if eq $float "end" }} + {{ $sidemargin = "ms-4" }} + {{ else }} + {{ errorf "paige/figure: invalid float: %q" $float }} + {{ 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 }} + +
+
+
{{ $content }}
+ + {{ if $showcaption }} +
{{ $caption }}
+ {{ end }} +
+