Merge pull request #2795 from alxhslm/tab-nested
fix: Tab shortcode supports nested shortcodes
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
{{- $label := .Get "label" -}}
|
||||
{{- $icon := .Get "icon" -}}
|
||||
{{- $index := .Parent.Store.Get "tab-index" | default 0 -}}
|
||||
{{- $content := .InnerDeindent | strings.TrimSpace | .Page.RenderString -}}
|
||||
{{- $md := .Get "md" | default true -}}
|
||||
{{- $isMarkdown := or (eq $md true) (eq $md "true") -}}
|
||||
{{- $content := .Inner -}}
|
||||
{{- if $isMarkdown -}}
|
||||
{{- $content = .InnerDeindent | strings.TrimSpace | .Page.RenderString -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $tabs := .Parent.Store.Get "tabs" | default slice -}}
|
||||
{{- .Parent.Store.Set "tabs" ($tabs | append (dict "label" $label "icon" $icon "content" $content)) -}}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
{{- $isActive = eq $nTabs 0 -}}
|
||||
{{- end -}}
|
||||
<div class="tab__panel {{ if $isActive }}tab--active{{ end }}" data-tab-index="{{ $nTabs }}">
|
||||
{{ index . "content" }}
|
||||
{{ index . "content" | safeHTML }}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user