summaryrefslogtreecommitdiff
path: root/themes/hugo-book/layouts/_shortcodes/columns.html
blob: 1d6abddf1a07d0647e12aa6e2ec2238a0b1766a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{{- $ratio := (split (.Get "ratio") ":") -}}
{{- if strings.Contains .InnerDeindent "<--->" -}}
{{ warnf "Columns shortcode seprator '<--->' is deprecated, use markdown list instead." -}}
<div class="book-columns flex flex-wrap{{ with .Get "class" }} {{ . }}{{ end }}">
{{ 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 -}}
<div class="book-columns book-columns-{{ .Ordinal }} {{ with .Get "class" }}{{ . }}{{ end }}">
{{ .InnerDeindent | safeHTML }}
</div>
{{ end -}}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.