github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/themes/docsy/layouts/shortcodes/imgproc.html (about) 1 {{ $original := .Page.Resources.GetMatch (printf "**%s*" (.Get 0)) }} 2 {{ $command := .Get 1 }} 3 {{ $options := .Get 2 }} 4 {{ if eq $command "Fit"}} 5 {{ .Scratch.Set "image" ($original.Fit $options) }} 6 {{ else if eq $command "Resize"}} 7 {{ .Scratch.Set "image" ($original.Resize $options) }} 8 {{ else if eq $command "Fill"}} 9 {{ .Scratch.Set "image" ($original.Fill $options) }} 10 {{ else }} 11 {{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}} 12 {{ end }} 13 {{ $image := .Scratch.Get "image" }} 14 <div class="card rounded p-2 td-post-card mb-4 mt-4" style="max-width: {{ add $image.Width 10 }}px"> 15 <img class="card-img-top" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> 16 {{ with .Inner }} 17 <div class="card-body px-0 pt-2 pb-0"> 18 <p class="card-text">{{ . }}{{ with $image.Params.byline }}<small class="text-muted"><br/>{{ . | html }}</small>{{ end }}</p> 19 </div> 20 {{ end }} 21 </div>