Fix figure centering
This commit is contained in:
@@ -14,34 +14,35 @@
|
||||
{{ $vertical := $params.vertical | default "center" }}
|
||||
{{ $width := $params.width }}
|
||||
|
||||
{{ $heightish := or $maxheight $height }}
|
||||
{{ $heights := slice }}
|
||||
{{ $showcaption := $caption }}
|
||||
{{ $sidemargin := "" }}
|
||||
{{ $style := slice }}
|
||||
{{ $table := false }}
|
||||
{{ $widthish := or $maxwidth $width }}
|
||||
{{ $widths := slice }}
|
||||
|
||||
{{ if and $caption (or $compact $float) }}
|
||||
{{ $table = true }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $height }}
|
||||
{{ $style = $style | append (printf "height: %v" $height) }}
|
||||
{{ $heights = $heights | append (printf "height: %v" $height) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $maxheight }}
|
||||
{{ $style = $style | append (printf "max-height: %v" $maxheight) }}
|
||||
{{ $heights = $heights | append (printf "max-height: %v" $maxheight) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $heights = delimit ($heights | sort) "; " }}
|
||||
|
||||
{{ if $maxwidth }}
|
||||
{{ $style = $style | append (printf "max-width: %v" $maxwidth) }}
|
||||
{{ $widths = $widths | append (printf "max-width: %v" $maxwidth) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $width }}
|
||||
{{ $style = $style | append (printf "width: %v" $width) }}
|
||||
{{ $widths = $widths | append (printf "width: %v" $width) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $style = delimit ($style | sort) "; " }}
|
||||
{{ $widths = delimit ($widths | sort) "; " }}
|
||||
|
||||
{{ if $float }}
|
||||
{{ if eq $float "start" }}
|
||||
@@ -66,26 +67,12 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<figure class="{{ if $widthish }} d-flex {{ end }} {{ with $float }} float-{{ . }} {{ end }} {{ if $widthish }} justify-content-{{ $horizontal }} {{ end }} {{ if $compact }} mb-0 {{ end }} {{ if $float }} {{ $sidemargin }} {{ end }} paige-figure {{ if $numbered }} paige-figure-numbered {{ end }}" {{ if and $float $style }} style="{{ $style | safeCSS }}" {{ end }}>
|
||||
{{ if or $heightish $widthish (and (not $float) $style) }}
|
||||
<div {{ if or $heightish $widthish }} class="{{ if $height }} d-flex flex-column justify-content-{{ $vertical }} {{ end }} overflow-auto" {{ end }} {{ if and (not $float) $style }} style="{{ $style | safeCSS }}" {{ 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 $table }}
|
||||
<div class="d-table">
|
||||
{{ end }}
|
||||
|
||||
<div class="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 }}
|
||||
|
||||
{{ if $table }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if or $heightish $widthish (and (not $float) $style) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ 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>
|
||||
|
Reference in New Issue
Block a user