huge upgrade to theme and pagefind search bar.
This commit is contained in:
33
themes/hugo-book.backup/layouts/_shortcodes/columns.html
Normal file
33
themes/hugo-book.backup/layouts/_shortcodes/columns.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- $ratio := (split (.Get "ratio") ":") -}}
|
||||
{{- if strings.Contains .InnerDeindent "<--->" -}}
|
||||
{{- warnf "Columns shortcode seprator '<--->' 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")
|
||||
)
|
||||
) -}}
|
||||
<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")
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{ .Inner | safeHTML -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user