{{ $alt := .Get "alt" -}} {{ $caption := .Get "caption" -}} {{ $class := .Get "class" -}} {{ $height := .Get "height" -}} {{ $inline := .Get "inline" | default false -}} {{ $link := .Get "link" -}} {{ $src := .Get "src" -}} {{ $width := .Get "width" -}} {{ if and $src (fileExists (path.Join "/assets" $src)) -}} {{ $original := resources.Get $src -}} {{ if $inline -}} {{ $src = $original.Content -}} {{ else -}} {{ $src = $original.RelPermalink -}} {{ end -}} {{ else if and $src $inline (fileExists (path.Join "/static" $src)) -}} {{ $src = readFile (path.Join "/static" $src) -}} {{ end -}} {{ if and $width $height -}} {{ $width = int $width -}} {{ $height = int $height -}} {{ else if $width -}} {{ $width = int $width -}} {{ else if $height -}} {{ $height = int $height -}} {{ end -}} {{ if $caption }}
{{ end -}} {{ with $link }}{{ end -}} {{ if $inline -}}
{{ $src | safeHTML }}
{{ else -}} {{ . }} {{ end -}} {{- if $link }}
{{ end }} {{ if $caption -}}
{{ $caption | markdownify -}}
{{ end -}}