{{ $error := false }} {{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "timeline" "args" .Params) }} {{ errorf "Invalid arguments: %s" .Position -}} {{ $error = true }} {{ end }} {{- $page := .Page -}} {{- $data := partial "utilities/GetI18nData.html" (dict "page" $page "data" (.Get "data"))}} {{ if not $data -}} {{ errorf "Invalid timeline data '%s': %s" .Get "data" .Position -}} {{ $error = true }} {{ end -}} {{ $background := .Get "background" | default "" -}} {{- $class := .Get "class" | default "" -}} {{- define "partials/timeline-icon.html" -}} {{- $col := default 6 .col -}} {{- $icon := .icon -}} {{- $direction := .direction -}}
{{ partial "assets/icon.html" (dict "icon" (printf "%s fa-fluid" $icon) "spacing" false) }}
{{- end -}} {{- define "partials/timeline-panel.html" -}} {{- $col := default 6 .col -}} {{- $page := .page -}} {{- $content := .content -}} {{- $color := .color -}} {{- $title := .title -}} {{- $badge := .badge -}} {{- $url := .url -}} {{- $date := .date -}} {{- if and $url (not (hasPrefix $url "http")) -}} {{- $url = partial "partials/utilities/URLJoin.html" (dict "base" site.Params.docs.release "path" $url) }} {{- end -}} {{- $direction := .direction -}}
{{ with $url }} {{ $title }} {{ if $badge }}{{ $badge }}{{ end }} {{ else}} {{ $title }} {{ if $badge }}{{ $badge }}{{ end }} {{ end }}
{{ if $date }} {{ $datestr := (partial "utilities/date.html" (dict "date" $date "format" "long")) -}}

{{ $datestr -}}

{{ end }}

{{ $content | $page.RenderString }}

{{- end -}}
{{ range $index, $item := $data }}
{{ if eq (mod $index 2) 1 }} {{ partial "partials/timeline-panel.html" (dict "page" $page "content" $item.content "color" $item.color "title" $item.title "badge" $item.badge "date" $item.date "url" $item.url "direction" "start") }} {{ partial "partials/timeline-icon.html" (dict "icon" $item.icon "direction" "start") }} {{ else }} {{ partial "partials/timeline-icon.html" (dict "icon" $item.icon "direction" "end") }} {{ partial "partials/timeline-panel.html" (dict "page" $page "content" $item.content "color" $item.color "title" $item.title "badge" $item.badge "date" $item.date "url" $item.url "direction" "end") }} {{ end }}
{{ end }}
{{ range $index, $item := $data }}
{{ partial "partials/timeline-icon.html" (dict "icon" $item.icon "direction" "end" "col" 3) }} {{ partial "partials/timeline-panel.html" (dict "page" $page "content" $item.content "color" $item.color "title" $item.title "badge" $item.badge "date" $item.date "url" $item.url "direction" "end" "col" 9) }}
{{ end }}