{{ 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" }} {{ if findRE "^https?" $url.Scheme }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ 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 }}
{{ with $href }}{{ end }} {{ $altText }} {{ if $href }}{{ end }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ else }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ end }} {{ end }} {{ end }}