{{ $align := .align | default "center" }} {{ $caption := .caption | markdownify }} {{ $compact := .compact }} {{ $content := .content | markdownify }} {{ $float := .float }} {{ $gap := .gap }} {{ $height := .height }} {{ $justify := .justify | default "center" }} {{ $maxheight := .maxheight }} {{ $maxwidth := .maxwidth }} {{ $number := .number }} {{ $numbered := .numbered }} {{ $width := .width }} {{ $table := false }} {{ if and $caption (or $compact $float) }} {{ $table = true }} {{ end }} {{ $style := "" }} {{ if $height }} {{ with printf "height: %v" $height }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ if $maxheight }} {{ with printf "max-height: %v" $maxheight }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ if $maxwidth }} {{ with printf "max-width: %v" $maxwidth }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ if $width }} {{ with printf "width: %v" $width }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ $sidemargin := "" }} {{ 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 }} {{ $showcaption := $caption }} {{ 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 and (not $float) $style }}
{{ end }} {{ if $table }}
{{ end }}
{{ $content }}
{{ if $showcaption }}
{{ $caption }}
{{ end }} {{ if $table }}
{{ end }} {{ if and (not $float) $style }}
{{ end }}