{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }} {{ $command := .Get 1 }} {{ $options := .Get 2 }} {{ if eq $command "Fit"}} {{ .Scratch.Set "image" ($original.Fit $options) }} {{ else if eq $command "Resize"}} {{ .Scratch.Set "image" ($original.Resize $options) }} {{ else if eq $command "Fill"}} {{ .Scratch.Set "image" ($original.Fill $options) }} {{ else if eq $command "Crop"}} {{ .Scratch.Set "image" ($original.Crop $options) }} {{ else }} {{ errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize."}} {{ end }} {{ $image := .Scratch.Get "image" }}
{{ with .Inner }} {{ . }} {{ else }} .{{ $command }} "{{ $options }}" {{ end }}