fix: fix rendering of nested shortcodes in tabs (#363)

This commit is contained in:
Robert Kaussow 2023-02-16 10:52:42 +01:00 committed by GitHub
parent e1c6517723
commit 1b203a991c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 16 deletions

View File

@ -6,9 +6,9 @@
<div class="gblog-columns gblog-columns--{{ $size }} flex flex-gap flex-mobile-column">
{{ range split .Inner "<--->" }}
{{- range split .Inner "<--->" }}
<div class="gblog-columns__content gblog-markdown--nested flex-even">
{{ . | $.Page.RenderString }}
</div>
{{ end }}
{{- end }}
</div>

View File

@ -1,12 +1,12 @@
{{ if .Parent }}
{{ $name := .Get 0 }}
{{ $group := printf "tabs-%s" (.Parent.Get 0) }}
{{- if .Parent }}
{{- $name := .Get 0 }}
{{- $group := printf "tabs-%s" (.Parent.Get 0) }}
{{ if not (.Parent.Scratch.Get $group) }}
{{ .Parent.Scratch.Set $group slice }}
{{ end }}
{{- if not (.Parent.Scratch.Get $group) }}
{{- .Parent.Scratch.Set $group slice }}
{{- end }}
{{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
{{ else }}
{{- .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
{{- else }}
{{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }}
{{ end }}
{{- end }}

View File

@ -1,10 +1,10 @@
{{ if .Inner }}{{ end }}
{{ $id := .Get 0 }}
{{ $group := printf "tabs-%s" $id }}
{{- if .Inner }}{{ end }}
{{- $id := .Get 0 }}
{{- $group := printf "tabs-%s" $id }}
<div class="gblog-tabs">
{{ range $index, $tab := .Scratch.Get $group }}
{{- range $index, $tab := .Scratch.Get $group }}
<input
type="radio"
class="gblog-tabs__control hidden"
@ -18,5 +18,5 @@
<div class="gblog-markdown--nested gblog-tabs__content">
{{ .Content | $.Page.RenderString }}
</div>
{{ end }}
{{- end }}
</div>