Overhaul figures

This commit is contained in:
Will Faught
2023-01-06 14:11:48 -08:00
parent fd81ccccd5
commit cf823d7d63
13 changed files with 624 additions and 148 deletions

View File

@@ -1,20 +1,41 @@
<figure class="align-items-center d-flex flex-column">
{{ $link := .Get 2 | default (.Get `link`) }}
{{ with $link }}
<a href="{{ . }}">
{{ end }}
{{ $src := .Get 0 | default (.Get `src`) }}
{{ $url := urls.Parse $src }}
{{ if and (not $url.IsAbs) (not (hasPrefix $url.Path "/")) }}
{{ with .Page.Resources.Get $src }}
{{ $src = .RelPermalink }}
{{ end }}
{{ end }}
<img{{ with (.Get 4 | default (.Get `alt`)) }} alt="{{ . }}"{{ end }} class="figure-img img-fluid"{{ with .Get `height` }} height="{{ . }}"{{ end }} loading="lazy" referrerpolicy="no-referrer" src="{{ $src }}"{{ with (.Get 3 | default (.Get `title`)) }} title="{{ . }}"{{ end }}{{ with .Get `width` }} width="{{ . }}"{{ end }}>
{{ if $link }}
</a>
{{ end }}
{{ with (.Get 1 | default (.Get `caption`)) }}
<figcaption class="figure-caption">{{ . }}</figcaption>
{{ end }}
</figure>
{{ $caption := .Get "caption" }}
{{ $captionclass := .Get "captionclass" }}
{{ $captionstyle := .Get "captionstyle" }}
{{ $class := .Get "class" }}
{{ $contentclass := .Get "contentclass" }}
{{ $contentstyle := .Get "contentstyle" }}
{{ $style := .Get "style" }}
{{ $alt := .Get "alt" }}
{{ $height := .Get "height" }}
{{ $imageclass := .Get "imageclass" }}
{{ $imagestyle := .Get "imagestyle" }}
{{ $method := .Get "method" }}
{{ $options := .Get "options" }}
{{ $src := .Get 0 | default (.Get "src") }}
{{ $title := .Get "title" }}
{{ $width := .Get "width" }}
{{ $link := .Get "link" }}
{{ partial "paige/image-figure.html" (dict
"caption" $caption
"captionclass" $captionclass
"captionstyle" $captionstyle
"class" $class
"contentclass" $contentclass
"contentstyle" $contentstyle
"style" $style
"alt" $alt
"height" $height
"imageclass" $imageclass
"imagestyle" $imagestyle
"method" $method
"options" $options
"src" $src
"title" $title
"width" $width
"link" $link
) }}