{{- $template := .block.template -}} {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data }}
{{ if or $title .description }}
{{ if $title }}

{{ partial "PrepareHTML" $title }}

{{ end }} {{- if .description }}
{{ partial "PrepareHTML" .description }}
{{ end -}}
{{ end -}}
{{ range .elements }}
{{ if .data.image }} {{- $direction = partial "GetImageDirection" .data.image -}} {{ end }}
{{- $title := partial "PrepareHTML" .title -}}

{{ $title }}

{{ if site.Params.events.index.show_description }} {{- if (partial "GetTextFromHTML" .summary) -}}

{{ if site.Params.events.index.truncate_description }} {{ partial "GetTruncateContent" ( dict "text" .summary "length" site.Params.events.index.truncate_description ) }} {{ else }} {{ partial "PrepareText" .summary }} {{ end }}

{{- end -}} {{- end -}}
{{ .dates.computed.short }}
{{ if .dates.from.hour }} {{ .dates.from.hour }} {{ end }} {{ if .dates.to.hour }} {{ .dates.to.hour }} {{ end }}
{{- if .image -}} {{- partial "commons/image.html" (dict "image" .image "sizes" site.Params.image_sizes.sections.events.item ) -}} {{- else if site.Params.events.default_image -}} {{- partial "commons/image-default.html" -}} {{- end -}}
{{ end -}}
{{ end -}}