{{ if .Get "caption" }} {{ $.Scratch.Set "caption" (.Get "caption") }} {{ else if .Get "alt" }} {{ $.Scratch.Set "caption" (.Get "alt") }} {{ end }} {{ $permalink := $.Page.Permalink }} {{ $image := .Get "src" }} {{ $image_link_absolute := (findRE "^/" $image) }}
{{ if .Get "link"}} {{ end }} {{ if .Get "link"}}{{ end }} {{ if ($.Scratch.Get "caption") }}
Figure {{ $.Page.Scratch.Get "fig" }}. {{ $.Scratch.Get "caption" | markdownify | plainify }} {{ if .Get "attr" }} [{{- with .Get "attrlink"}}{{ end }}{{ .Get "attr" | markdownify }}{{ if .Get "attrlink"}}{{ end -}}] {{ end }}
{{ end }}
{{ .Page.Scratch.Add "fig" 1 }} {{ $.Scratch.Delete "caption"}}