2019-02-13 20:54:04 +01:00
|
|
|
{{ $img := .Get "img" }}
|
|
|
|
{{ $caption := .Get "caption" }}
|
|
|
|
{{ $command := .Get "command" }}
|
|
|
|
{{ $options := .Get "options" }}
|
|
|
|
|
|
|
|
{{ $original := .Page.Resources.GetMatch (printf "*%s*" $img) }}
|
2019-02-12 23:25:13 +01:00
|
|
|
{{ $new := "" }}
|
|
|
|
|
2019-02-13 20:54:04 +01:00
|
|
|
{{ if eq $command "Fit" }}
|
|
|
|
{{ $new = $original.Fit $options }}
|
|
|
|
{{ else if eq $command "Fill" }}
|
|
|
|
{{ $new = $original.Fill $options }}
|
|
|
|
{{ else if eq $command "Resize" }}
|
|
|
|
{{ $new = $original.Resize $options }}
|
|
|
|
{{ else if eq $command "Original" }}
|
2019-02-12 23:25:13 +01:00
|
|
|
{{ $new = $original }}
|
|
|
|
{{ else }}
|
|
|
|
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
|
|
|
|
{{ end }}
|
|
|
|
|
2019-02-13 20:54:04 +01:00
|
|
|
<figure role="group" aria-describedby="caption-{{ $caption | md5 }}">
|
2020-11-25 03:51:01 +01:00
|
|
|
<a href="{{ $original.RelPermalink }}" class="img-link">
|
|
|
|
<img src="{{ $new.RelPermalink }}">
|
2019-02-12 23:25:13 +01:00
|
|
|
</a>
|
2019-02-13 20:54:04 +01:00
|
|
|
<figcaption id="caption-{{ $caption | md5 }}">
|
|
|
|
{{ $caption | markdownify }}
|
2017-11-02 16:39:45 +01:00
|
|
|
</figcaption>
|
|
|
|
</figure>
|