{{- $tabsID := .id }} {{- /* The `tabs` parameter is a list of dict with the following keys: - `id`: (int) the ID of the tab (the Ordinal of the tab shortcode). - `name`: (string) the name of the tab (the title). - `content`: (string) the content of the tab. - `selected`: (bool) whether the tab is selected. */ -}} {{- $tabs := .tabs }} {{- if eq (len $tabs) 0 -}} {{ errorf "tabs must have at least one tab" }} {{- end -}} {{- $enableSync := .enableSync }} {{- /* Create group data for syncing and select the first tab if none is selected. */ -}} {{- $selectedIndex := 0 -}} {{ $dataTabGroup := slice -}} {{- range $i, $item := $tabs -}} {{- $dataTabGroup = $dataTabGroup | append ($item.name) -}} {{- if $item.selected -}} {{- $selectedIndex = $i -}} {{- end -}} {{- end -}} {{- /* Generate a unique ID for each tab group. */ -}} {{- $globalID := printf "tabs-%02v" $tabsID -}}