{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} {{- $.Page.Scratch.Add "figurecount" 1 -}} {{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }}
{{ with .Get "link" | default (.Get "src") }}{{ end }} {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
{{- with .Get "title" }}

{{.}}

{{ end }} {{- if or (.Get "caption") (.Get "attr")}}

{{- .Get "caption" -}} {{- with .Get "attrlink"}}{{ .Get "attr" }}{{ else }}{{ .Get "attr"}}{{ end -}}

{{- end }}
{{- end }}