mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-12-02 12:13:05 +00:00
28 lines
No EOL
1.2 KiB
HTML
28 lines
No EOL
1.2 KiB
HTML
{{- $context := .context }}
|
|
{{- $tabs := .content | default slice }}
|
|
{{- $groupid := .groupid | default (partial "make-random-md5.hugo" $context) }}
|
|
{{- with $context }}
|
|
<div class="tab-panel cstyle default" data-tab-group="{{ $groupid }}">
|
|
<div class="tab-nav">
|
|
{{- range $idx, $tab := $tabs }}
|
|
<button
|
|
data-tab-item="{{ .name | $context.RenderString | plainify }}"
|
|
class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}"
|
|
onclick="switchTab('{{ $groupid }}','{{ .name | $context.RenderString | plainify}}')"
|
|
>
|
|
<div><div>{{ .name | $context.RenderString }}</div></div>
|
|
</button>
|
|
{{- end }}
|
|
</div>
|
|
<div class="tab-content">
|
|
{{- range $idx, $tab := $tabs }}
|
|
<div
|
|
data-tab-item="{{ .name | $context.RenderString | plainify }}"
|
|
class="tab-content-text{{ cond (eq $idx 0) " active" ""}}"
|
|
>
|
|
{{ if ne "<" (substr (strings.TrimLeft " " .content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work -->
|
|
{{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
|
|
{{- end }}
|
|
</div>
|
|
</div>
|
|
{{- end }} |