{{- $page := .page }} {{- if and (not $page) .context }} {{- $page = .context }} {{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tabs' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }} {{- end }} {{- $groupid := printf "R-tabs-%s" (or .groupid (partial "_relearn/makeRandomMd5.gotmpl" $page) | md5) }} {{- $style := .style }} {{- $color := .color }} {{- $icon := .icon }} {{- $title := .title }} {{- $tabs := slice }} {{- range $tab := (.content | default slice) }} {{- if and (not $tab.title) $tab.name }} {{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }} {{- warnf "%q: DEPRECATED parameter 'name' for shortcode 'tab' found, use 'title' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-16-0" $filepath }} {{- $tab = merge $tab (dict "title" .name) }} {{- end }} {{- with $tab }} {{- $content := trim .content "\n\r\t " }} {{- $hasContent := ne (strings.TrimPrefix "

" $content) "" }} {{- $style := .style | default $style | default "" }} {{- $color := .color | default $color | default "" }} {{- $icon := .icon | default "" }} {{- $title := .title | default "" }} {{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "mode" "tabs" "style" $style "color" $color "icon" $icon "title" $title) }} {{- $style = $boxStyle.style }} {{- $color = $boxStyle.color }} {{- $icon := $boxStyle.icon }} {{- $title := $boxStyle.title }} {{- $id := partial "_relearn/makeRandomMd5.gotmpl" $page }} {{- /* a tab may have only an icon with no title, so we need to take this into account for groupid switching */}} {{- $itemid := or ($title | $page.RenderString | plainify) $icon | md5 }} {{- if $hasContent }} {{- $tabs = $tabs | append (dict "color" $color "content" $content "icon" $icon "id" (printf "R-tab-id-%s" $id) "itemid" (printf "R-tab-%s" $itemid) "style" $style "title" $title ) }} {{- end }} {{- end }} {{- end }} {{- $style = .style | default "" }} {{- $color = .color | default "" }} {{- $icon := .icon | default "" }} {{- $title := .title | default "" }} {{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "mode" "tabs" "style" $style "color" $color "icon" $icon "title" $title) }} {{- $color = $boxStyle.color }} {{- $style = $boxStyle.style }} {{- $icon := $boxStyle.icon }} {{- $title := $boxStyle.title }} {{- with $page }} {{- if len $tabs -}}

{{ if $icon }}{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | $page.RenderString }}{{ if (not $title) }}​{{ end }}
{{- range $idx, $tab := $tabs }} {{- end }}
{{- range $idx, $tab := $tabs }}
{{ .content | safeHTML }}
{{- end }}
{{- end }} {{- end }}