{{ $fig := newScratch }} {{ if .Get "caption" }} {{ $fig.Set "caption" (.Get "caption") }} {{ else if .Get "alt" }} {{ $fig.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 ($fig.Get "caption") }}
Figure {{ $.Page.Scratch.Get "fig" }}. {{ $fig.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 }} {{ $fig.Delete "caption"}}