{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} {{ 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" }} {{- $target := .Get "target" | default "_blank" }} {{- $nozoom := .Get "nozoom" | default false -}}
{{- with $href }}{{ end -}} {{- if findRE "^https?" $url.Scheme }} {{ $altText }} {{- else }} {{- $resource := "" }} {{- if $.Page.Resources.GetMatch ($url.String) }} {{- $resource = $.Page.Resources.GetMatch ($url.String) }} {{- else if resources.GetMatch ($url.String) }} {{- $resource = resources.Get ($url.String) }} {{- end }} {{- with $resource }} {{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}} {{ $altText }} {{- else }} {{ $altText }} {{- end }} {{- else }} {{ $altText }} {{- end }} {{- end }} {{ with $caption }}
{{ . | markdownify }}
{{ end }} {{ if $href }}
{{ end }}
{{- end -}}