Merge commit 'd276e901b36d2576ef8350ed96b17f66254eac1b'

This commit is contained in:
Bjørn Erik Pedersen
2022-03-26 11:04:57 +02:00
28 changed files with 663 additions and 389 deletions

View File

@@ -1,27 +1,26 @@
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
{{ $command := .Get 1 }}
{{ $options := .Get 2 }}
{{ if eq $command "Fit"}}
{{ .Scratch.Set "image" ($original.Fit $options) }}
{{ $img = $img.Fit $options }}
{{ else if eq $command "Resize"}}
{{ .Scratch.Set "image" ($original.Resize $options) }}
{{ $img = $img.Resize $options }}
{{ else if eq $command "Fill"}}
{{ .Scratch.Set "image" ($original.Fill $options) }}
{{ $img = $img.Fill $options }}
{{ else if eq $command "Crop"}}
{{ .Scratch.Set "image" ($original.Crop $options) }}
{{ $img = $img.Crop $options }}
{{ else }}
{{ errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize."}}
{{ errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize."}}
{{ end }}
{{ $image := .Scratch.Get "image" }}
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
<figcaption>
<small>
{{ with .Inner }}
{{ . }}
{{ else }}
.{{ $command }} "{{ $options }}"
{{ end }}
</small>
</figcaption>
</figure>
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
<figcaption>
<small>
{{ with .Inner }}
{{ . }}
{{ else }}
.{{ $command }} "{{ $options }}"
{{ end }}
</small>
</figcaption>
</figure>