{{- $ratio := (split (.Get "ratio") ":") -}}
{{- if strings.Contains .InnerDeindent "<--->" -}}
{{- warnf "Columns shortcode separator '<--->' is deprecated, use markdown list instead." -}}
{{- $attributes := partial "docs/text/mapper" (dict
  "attributes" (cond .IsNamedParams .Params dict)
  "merge" (dict
    "class" (slice "book-columns" "flex" "flex-wrap")
    "id" (printf "book-columns-%d" .Ordinal)
  )
) -}}
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
{{- range $index, $content := split .InnerDeindent "<--->" -}}
  {{- $grow := default 1 (index $ratio $index) -}}
  <div class="flex-even markdown-inner" style="flex-grow: {{ $grow }};">
    {{- $content | safeHTML -}}
  </div>
{{- end -}}
</div>
{{- else -}}
{{- if .Get "ratio" -}}
<style>{{- range $index, $grow := $ratio -}}
#book-columns-{{ $.Ordinal }}>ul>li:nth-child({{ $index | add 1 }}) {
  flex-grow: {{ default 1 $grow }};
}
{{ end -}}
</style>
{{- end -}}
{{- $attributes := partial "docs/text/mapper" (dict
  "attributes" (cond .IsNamedParams .Params dict)
  "merge" (dict
    "class" (slice "book-columns")
    "id" (printf "book-columns-%d" .Ordinal)
  )
) -}}
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
{{ .Inner | safeHTML -}}
</div>
{{- end -}}
