{{ $alt := .Get "alt" | default "Image" }} {{ $type := .Get "type" | default "normal" }} {{- $ind := .Get "ind" | default .Site.Params.marginNoteInd -}} {{- $label := printf "%#v" (add .Ordinal 1) | printf "%s%s" "marginfig-" | printf "%s" -}} {{- if .Get "label" -}} {{- $label = .Get "label" -}} {{- end -}} {{- if not (eq $type "margin") -}} {{ if eq $type "full" }}
{{ else }}
{{ end }} {{- end -}} {{- if eq $type "full" -}} {{ with .Get "link" }}{{ end }} {{ $alt }} {{ if .Get "link" }}{{ end }}
{{- else -}} {{- if or (or (.Get "caption") (.Get "attr")) (eq $type "margin") -}} {{- end -}} {{- if eq $type "margin" -}} {{ with .Get "link" }}{{ end }} {{ $alt }} {{ if .Get "link" }}{{ end }} {{- end -}} {{- end -}} {{ with .Get "title"}}{{ . | markdownify }}. {{ end}} {{ with .Get "caption"}}{{ . | markdownify }}{{ end }} {{ with .Get "attr" }}{{ . | markdownify }}.{{ end }} {{ if eq $type "full" }}
{{ else }} {{- if or (or (.Get "caption") (.Get "attr")) (eq $type "margin") -}}{{- end -}} {{ end }} {{ if (eq $type "normal") }} {{ with .Get "link" }}{{ end }} {{ $alt }} {{ if .Get "link" }}{{ end }} {{ end }} {{ if not (eq $type "margin") }}
{{ end }}