{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} {{- $.Page.Scratch.Add "figurecount" 1 -}} {{- $thumb := .Get "src" -}} {{- $figid := "" -}} {{- $galid := "" -}} {{- $id := "" -}} {{- $previd := "" -}} {{- $nextid := "" -}} {{- if .Parent -}} {{- $galid = .Page.Scratch.Get "gallery" -}} {{- if not $galid }}{{ $galid = 0 }}{{ end -}} {{- $galid = add $galid 1 -}} {{- $.Page.Scratch.Add "thisgalfig" 1 -}} {{- $figid = .Page.Scratch.Get "thisgalfig" -}} {{- else -}} {{- $.Page.Scratch.Add "nogalfig" 1 -}} {{- $figid = .Page.Scratch.Get "nogalfig" -}} {{- end -}} {{- if $galid -}} {{- $id = print "gal" $galid "-" "fig" $figid -}} {{- $previd = print "gal" $galid "-" "fig" (sub $figid 1) -}} {{- $nextid = print "gal" $galid "-" "fig" (add $figid 1) -}} {{- else -}} {{- $id = print "fig" $figid -}} {{- end -}} {{ if (.Get "link") -}} {{ else -}} {{ if not (eq (.Get "lightbox") "none") }}{{ end }} {{- end -}} {{- if or (.Get "caption") (.Get "attr")}} {{- .Get "caption" | markdownify -}} {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} {{- end }} {{- if not (eq (.Get "lightbox") "none") -}} {{- if or (.Get "caption") (.Get "attr") -}} {{- .Get "caption" | markdownify -}} {{- with .Get "attrlink" }} {{- end -}} {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} {{- with .Get "attrlink" }}{{- end -}} {{- end }} {{- if .Parent -}} {{- if not (eq $figid 1) -}} {{- else -}} {{- end -}} {{- end }} {{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}} {{- .Get "caption" | markdownify -}} {{- with .Get "attrlink" }} {{- end -}} {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} {{- with .Get "attrlink" }}{{- end -}} {{- end }}