{{ if .Get "default" }} {{ template "_internal/shortcodes/figure.html" . }} {{ else }} {{ $url := urls.Parse (.Get "src") }} {{ $altText := .Get "alt" }} {{ $caption := .Get "caption" }} {{ $href := .Get "href" }} {{ $class := .Get "class" }} {{ $file := $url.Path }} {{ $img := .Page.Resources.GetMatch $file }} {{- if and (not $img) .Page.File }} {{ $path := path.Join .Page.File.Dir $file }} {{ $img = resources.Get $path }} {{ end -}} {{ with $href }}{{ end }} {{- with $img -}} {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class) }} {{- else -}} {{ $altText }} {{- end -}} {{ with $href }}{{ end }} {{ with $caption }}
{{ . | markdownify }}
{{ end }} {{ end }}