{{- $wcPage := .wcPage -}} {{- $wcBlock := .wcBlock -}} {{- $wcIdentifier := .wcIdentifier -}} {{- $content := $wcBlock.content -}} {{- if not (reflect.IsMap $content) }}{{ $content = dict }}{{ end -}} {{- $design := $wcBlock.design -}} {{- if not (reflect.IsMap $design) }}{{ $design = dict }}{{ end -}} {{/* Enable Alpine.js for interactive accordion */}} {{ $wcPage.Page.Store.Set "has_alpine" true }} {{- $st := index $design "spacing" -}} {{- if not (reflect.IsMap $st) }}{{ $st = dict }}{{ end -}} {{- $pad := slice "20px" "0" "20px" "0" -}} {{- $pad_raw := index $st "padding" -}} {{- if and (reflect.IsSlice $pad_raw) (ge (len $pad_raw) 4) }}{{ $pad = $pad_raw }}{{ end -}} {{- $pad_sm := slice "3rem" "0" -}} {{- $pad_sm_raw := index $st "padding_sm" -}} {{- if and (reflect.IsSlice $pad_sm_raw) (ge (len $pad_sm_raw) 2) }}{{ $pad_sm = $pad_sm_raw }}{{ end -}} {{- $mar := slice "0" "0" "0" "0" -}} {{- $mar_raw := index $st "margin" -}} {{- if and (reflect.IsSlice $mar_raw) (ge (len $mar_raw) 4) }}{{ $mar = $mar_raw }}{{ end -}} {{- $bg := index $design "background" -}} {{- if not (reflect.IsMap $bg) }}{{ $bg = dict }}{{ end -}} {{- $bg_color_val := "" -}} {{- $bg_color_raw := index $bg "color" -}} {{- if eq (printf "%T" $bg_color_raw) "string" }}{{ $bg_color_val = $bg_color_raw }}{{ end -}} {{- $title := "" -}} {{- $title_raw := index $content "title" -}} {{- if eq (printf "%T" $title_raw) "string" }}{{ $title = $title_raw }}{{ end -}} {{- $subtitle := "" -}} {{- $subtitle_raw := index $content "subtitle" -}} {{- if eq (printf "%T" $subtitle_raw) "string" }}{{ $subtitle = $subtitle_raw }}{{ end -}} {{- $text := "" -}} {{- $text_raw := index $content "text" -}} {{- if eq (printf "%T" $text_raw) "string" }}{{ $text = $text_raw }}{{ end -}} {{- $items_raw := index $content "items" -}} {{- $items := slice -}} {{- if reflect.IsSlice $items_raw }}{{ $items = $items_raw }}{{ end -}} {{- $button := index $content "button" -}} {{- if not (reflect.IsMap $button) }}{{ $button = dict }}{{ end -}} {{- $button_text := "" -}} {{- with index $button "text" }}{{ $button_text = strings.TrimSpace (printf "%v" .) }}{{ end -}} {{- $button_url := "" -}} {{- with index $button "url" }}{{ $button_url = strings.TrimSpace (printf "%v" .) }}{{ end -}} {{- $button_icon := "" -}} {{- with index $button "icon" }}{{ $button_icon = printf "%v" . }}{{ end -}}
{{- with $title -}}

{{ . | markdownify | emojify }}

{{- with $subtitle -}}

{{ . | markdownify | emojify }}

{{- end -}}
{{- end -}} {{- with $text -}}
{{ . | markdownify | emojify }}
{{- end -}} {{- if gt (len $items) 0 -}}
{{- range $index, $item := $items -}} {{- if reflect.IsMap $item -}} {{- $question := "" -}} {{- $question_raw := index $item "question" | default (index $item "title") -}} {{- if ne $question_raw nil }}{{ $question = printf "%v" $question_raw }}{{ end -}} {{- $answer := "" -}} {{- $answer_raw := index $item "answer" | default (index $item "text") -}} {{- if ne $answer_raw nil }}{{ $answer = printf "%v" $answer_raw }}{{ end -}} {{- if or $question $answer -}}
{{ $answer | markdownify | emojify }}
{{- end -}} {{- end -}} {{- end -}}
{{- end -}} {{- if and $button_text $button_url -}} {{- $link := $button_url -}} {{- $target := "" -}} {{- $scheme := (urls.Parse $link).Scheme -}} {{- if not $scheme -}} {{- if not (hasPrefix $link "#") -}} {{- $link = $link | relLangURL -}} {{- end -}} {{- if eq (path.Ext $link) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end -}} {{- else if in (slice "http" "https") $scheme -}} {{- $target = "target=\"_blank\" rel=\"noopener\"" -}} {{- end -}} {{- end -}}