{{- $position := .block.position -}} {{- $template := .block.template -}} {{- $title := .block.title -}} {{- $layout := .block.data.layout | default "no_background" -}} {{- $class := "block block-chapter" -}} {{- $image_class := "" -}} {{- with .block.data -}} {{ if .image }} {{- $class = printf "%s block-chapter--with-image" $class -}} {{- $image_class = printf "image-%s" (partial "GetImageDirection" .image) -}} {{ end }} {{- $layout_class := printf "block-chapter--%s" $layout -}} {{- $class = printf "%s %s" $class $layout_class -}}
{{- if not $title -}} {{ partial "blocks/default_title.html" $template }} {{ else }}

{{ partial "PrepareHTML" $title }}

{{ end -}} {{ if (partial "GetTextFromHTML" .text) -}}
{{ partial "PrepareHTML" .text }}
{{ end -}} {{ if (partial "GetTextFromHTML" .notes) }}
{{ partial "PrepareHTML" .notes }}
{{ end -}}
{{ if .image }}
{{ partial "commons/image.html" (dict "image" .image "sizes" site.Params.image_sizes.blocks.chapter )}} {{ if partial "GetTextFromHTML" .credit }}
{{ partial "PrepareHTML" .credit }}
{{ end }}
{{ end -}}
{{- end -}}