{{ $id := delimit (slice "carousel" (partial "functions/uid.html" .) (now.UnixNano)) "-" }} {{ $aspect := (split (.Get "aspectRatio") "-") }} {{ $aspectx := default "16" (index $aspect 0) }} {{ $aspecty := default "9" (index $aspect 1) }} {{ $interval := default "2000" (.Get "interval") }} {{ $page := .Page.Resources }} {{ $imagesTemp := .Get "images" }} {{ $imagesTemp = strings.TrimPrefix "{" $imagesTemp }} {{ $imagesTemp = strings.TrimSuffix "}" $imagesTemp }} {{ $imagesTemp := strings.Split $imagesTemp "," }} {{ $images := slice }} {{ range $imagesTemp }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $images = $images | append (dict "resource" (resources.GetRemote .) "key" .) }} {{ else }} {{ range ($page.Match .) }} {{ $images = $images | append (dict "resource" . "key" .Name) }} {{ end }} {{ end }} {{ end }} {{ $captionsParam := .Get "captions" }} {{ $captions := dict }} {{ if $captionsParam }} {{ $captionsTemp := strings.TrimPrefix "{" $captionsParam }} {{ $captionsTemp = strings.TrimSuffix "}" $captionsTemp }} {{ range (strings.Split $captionsTemp ",") }} {{ $pair := strings.Split . ":" }} {{ if ge (len $pair) 2 }} {{ $key := strings.TrimSpace (index $pair 0) }} {{ $value := strings.TrimSpace (delimit (after 1 $pair) ":") }} {{ $captions = merge $captions (dict $key $value) }} {{ end }} {{ end }} {{ end }} {{ if not .Parent }}
{{ end }}