You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.5 KiB
HTML
74 lines
2.5 KiB
HTML
{{ $params := . }}
|
|
|
|
{{ $caption := $params.caption | markdownify }}
|
|
{{ $compact := $params.compact }}
|
|
{{ $content := $params.content | markdownify }}
|
|
{{ $float := $params.float }}
|
|
{{ $gap := $params.gap }}
|
|
{{ $height := $params.height }}
|
|
{{ $horizontal := $params.horizontal | default "center" }}
|
|
{{ $maxwidth := $params.maxwidth }}
|
|
{{ $number := $params.number }}
|
|
{{ $numbered := $params.numbered }}
|
|
{{ $vertical := $params.vertical | default "center" }}
|
|
{{ $width := $params.width }}
|
|
|
|
{{ $heights := slice }}
|
|
{{ $showcaption := $caption }}
|
|
{{ $sidemargin := "" }}
|
|
{{ $table := false }}
|
|
{{ $widths := slice }}
|
|
|
|
{{ if and $caption (or $compact $float) }}
|
|
{{ $table = true }}
|
|
{{ end }}
|
|
|
|
{{ if $height }}
|
|
{{ $heights = $heights | append (printf "height: %v" $height) }}
|
|
{{ end }}
|
|
|
|
{{ $heights = delimit ($heights | sort) "; " }}
|
|
|
|
{{ 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 "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 }}
|
|
|
|
<div class="align-items-{{ $vertical }} d-flex {{ with $float }} float-{{ . }} {{ end }} justify-content-{{ $horizontal }} {{ if $compact }} mb-0 {{ else }} mb-3 {{ end }} {{ with $sidemargin }} {{ . }} {{ end }} overflow-auto paige-figure {{ if $numbered }} paige-figure-numbered {{ end }}" {{ with $heights }} style="{{ . | safeCSS }}" {{ end }}>
|
|
<figure class="{{ if $table }} d-table {{ end }} mb-0" {{ with $widths }} style="{{ . | safeCSS }}" {{ end }}>
|
|
<div class="d-flex justify-content-{{ $horizontal }} text-{{ $horizontal }}">{{ $content }}</div>
|
|
|
|
{{ if $showcaption }}
|
|
<figcaption class="figure-caption {{ with $gap }} mt-{{ . }} {{ end }} text-{{ $horizontal }}" {{ if $table }} style="caption-side: bottom; display: table-caption" {{ end }}>{{ $caption }}</figcaption>
|
|
{{ end }}
|
|
</figure>
|
|
</div>
|