{{ $caption := .caption | markdownify }} {{ $compact := .compact }} {{ $content := .content | markdownify }} {{ $float := .float }} {{ $gap := .gap }} {{ $height := .height }} {{ $horizontal := .horizontal | default "center" }} {{ $maxheight := .maxheight }} {{ $maxwidth := .maxwidth }} {{ $number := .number }} {{ $numbered := .numbered }} {{ $vertical := .vertical | default "center" }} {{ $width := .width }} {{ $heightish := or $maxheight $height }} {{ $showcaption := $caption }} {{ $sidemargin := "" }} {{ $style := slice }} {{ $table := false }} {{ $widthish := or $maxwidth $width }} {{ if and $caption (or $compact $float) }} {{ $table = true }} {{ end }} {{ if $height }} {{ $style = $style | append (printf "height: %v" $height) }} {{ end }} {{ if $maxheight }} {{ $style = $style | append (printf "max-height: %v" $maxheight) }} {{ end }} {{ if $maxwidth }} {{ $style = $style | append (printf "max-width: %v" $maxwidth) }} {{ end }} {{ if $width }} {{ $style = $style | append (printf "width: %v" $width) }} {{ end }} {{ $style = delimit ($style | sort | uniq) "; " }} {{ if $float }} {{ if eq $float "start" }} {{ $sidemargin = "me-4" }} {{ else if eq $float "end" }} {{ $sidemargin = "ms-4" }} {{ else }} {{ errorf "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 }}
{{ if $table }}
{{ end }}
{{ $content }}
{{ if $showcaption }}
{{ $caption }}
{{ end }} {{ if $table }}
{{ end }}