{{- $type := .Get "type" }} {{- $figID := print "fig-" .Page.File.UniqueID "-" .Ordinal }} {{- if not (eq $type "margin") }} {{- if eq $type "full" }}
{{- else }}
{{- end }} {{- end }} {{- if eq $type "full" }} {{- with .Get "link" }}{{ end }}  {{ . }} {{- if .Get "link" }}{{ end }}
{{- else }} {{- if eq $type "margin" }} {{- with .Get "link" }} {{- end }}  {{ . }} {{- if .Get "link" }}{{ end }} {{ else }} {{- end }} {{- end }} {{ with .Get "title" }}{{ . }} {{ end }} {{ with .Get "caption" }}{{ . }}{{ end }} {{ with .Get "attrlink" }}{{ end }} {{- with .Get "attr" }}{{ . }}{{ end }} {{- if .Get "attrlink" }}{{ end }} {{- if eq $type "full" }}
{{- else }} {{- end }} {{- if and (not (eq $type "full")) (not (eq $type "margin")) }} {{ with .Get "link" }}{{ end }} {{ . }} {{- if .Get "link" }}{{ end }} {{- end }} {{- if not (eq $type "margin") }}
{{- end }}