tab.html (364B)


1
2
3
4
5
6
7
8
9
10
11
12
{{ if .Parent -}}
  {{- $name := trim (.Get "name") " " -}}
  {{- if not (.Parent.Scratch.Get "tabs") -}}
    {{- .Parent.Scratch.Set "tabs" slice -}}
  {{- end -}}
  {{- with .Inner }}
    {{ $.Parent.Scratch.Add "tabs" (dict "name" $name "content" . ) -}}
  {{ end }}
{{ else }}
  {{- errorf "[%s] %q: tab shortcode missing its parent" .Page.Path -}}
{{- end }}