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.

120 lines
2.9 KiB
HTML

{{ $alt := .alt }}
{{ $caption := .caption }}
{{ $float := .float }}
{{ $height := .height }}
{{ $link := .link }}
{{ $maxheight := .maxheight }}
{{ $maxwidth := .maxwidth }}
{{ $method := .method }}
{{ $options := .options }}
{{ $page := .page }}
{{ $resource := .resource }}
{{ $src := .src }}
{{ $table := .table }}
{{ $title := .title }}
{{ $width := .width }}
{{ $class := "img-fluid" }}
{{ if $caption }}
{{ $class = "figure-img img-fluid" }}
{{ end }}
{{ $content := partial "paige/img.html" (dict
"alt" $alt
"class" $class
"method" $method
"options" $options
"page" $page
"resource" $resource
"src" $src
"title" $title
) }}
{{ if $link }}
{{ $content = partial "paige/a.html" (dict
"content" $content
"href" $link
) }}
{{ 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 }}
{{ if $table }}
<figure class="d-table mb-0 paige-figure text-center">
{{ $content }}
{{ with $caption }}
<figcaption class="figure-caption" style="caption-side: bottom; display: table-caption">{{ . }}</figcaption>
{{ end }}
</figure>
{{ else if $float }}
{{ $margin := "" }}
{{ if eq $float "start" }}
{{ $margin = "me-4" }}
{{ else if eq $float "end" }}
{{ $margin = "ms-4" }}
{{ else }}
{{ errorf "invalid float: %q" $float }}
{{ end }}
<figure class="d-table float-{{ $float }} {{ $margin }} paige-figure text-center" {{ with $style }} style="{{ . | safeCSS }}" {{ end }}>
{{ $content }}
{{ with $caption }}
<figcaption class="figure-caption" style="caption-side: bottom; display: table-caption">{{ . }}</figcaption>
{{ end }}
</figure>
{{ else }}
<figure class="paige-figure text-center">
{{ with $style }}
<div class="align-items-center d-flex flex-column">
<div style="{{ . }}">
{{ end }}
{{ $content }}
{{ with $caption }}
<figcaption class="figure-caption">{{ . }}</figcaption>
{{ end }}
{{ if $style }}
</div>
</div>
{{ end }}
</figure>
{{ end }}