docs/daprdocs/layouts/_shortcodes/codetab.html

21 lines
815 B
HTML

{{- $index := .Ordinal -}}
<!-- Make sure that we are enclosed within a tabpane shortcode block -->
{{- if ne .Parent.Name "tabpane" -}}
{{- errorf "tab must be used within a tabpane block" -}}
{{- end -}}
<!-- Generate the unique ID based on the enclosing tabpane .Ordinal -->
{{- $guid := printf "tabpane-%d" .Parent.Ordinal -}}
<!-- Trim any leading and trailing newlines from .Inner, this avoids
spurious lines during syntax highlighting -->
{{- $entry := .Parent.Get $index -}}
{{- $entry := lower $entry -}}
{{- $tabid := printf "%s-%s-tab" $guid $entry | anchorize -}}
{{- $entryid := printf "%s-%s" $guid $entry | anchorize -}}
<div class="tab-pane fade{{ if eq $index 0 }} show active{{ end }}" id="{{ $entryid }}" role="tabpanel" aria-labelled-by="{{ $tabid }}">
<br />
{{- .Inner -}}
</div>