{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} {{- $.Page.Scratch.Add "figurecount" 1 -}} {{- $files := readDir (print "/static" (.Get "srcdir")) -}} {{- $maxid := len $files -}} {{- range $files -}} {{ $src := (print ($.Get "srcdir") "/" .Name) }} {{- $thumb := $src -}} {{- $figid := "" -}} {{- $galid := "" -}} {{- $id := "" -}} {{- $previd := "" -}} {{- $nextid := "" -}} {{- $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" -}} {{- $id = print "gal" $galid "-" "fig" $figid -}} {{- $previd = print "gal" $galid "-" "fig" (sub $figid 1) -}} {{- $nextid = print "gal" $galid "-" "fig" (add $figid 1) -}}
{{- if not (eq $figid 1) -}} {{- else -}} {{- end -}} {{- if not (eq $figid $maxid) -}} {{- else -}} {{- end }}
{{ end }}