From ae666b2b77df9122c1a26e686bb38a3f0f998f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 23 Jun 2022 13:24:54 +0200 Subject: [PATCH] tabs: unify parameter names #277 --- exampleSite/content/shortcodes/tabs.en.md | 22 +++++++++++----------- layouts/partials/shortcodes/tabs.html | 8 ++++---- layouts/shortcodes/tabs.html | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/exampleSite/content/shortcodes/tabs.en.md b/exampleSite/content/shortcodes/tabs.en.md index 1eb68cafb8..877fde4114 100644 --- a/exampleSite/content/shortcodes/tabs.en.md +++ b/exampleSite/content/shortcodes/tabs.en.md @@ -5,7 +5,7 @@ title = "Tabbed views" The `tabs` shortcode displays arbitrary content in unlimited number of tabs. This comes in handy eg. for providing code snippets for multiple languages or providing configuration in different formats. -{{< tabs groupId="tabs-example-language" >}} +{{< tabs groupid="tabs-example-language" >}} {{% tab name="python" %}} ```python @@ -26,7 +26,7 @@ echo "Hello World!" While the examples are using shortcodes with named parameter you are free to also call this shortcode from your own partials. -{{< tabs groupId="shortcode-parameter">}} +{{< tabs groupid="shortcode-parameter">}} {{% tab name="shortcode" %}} ````go @@ -70,21 +70,21 @@ echo "Hello World!" | Name | Default | Notes | |:----------------------|:-----------------|:------------| -| **groupId** | `default` | Arbitrary name of the group the tab view belongs to.

Tab views with the same **groupId** sychronize their selected tab. This sychronization applies to the whole site! | +| **groupid** | `default` | Arbitrary name of the group the tab view belongs to.

Tab views with the same **groupid** sychronize their selected tab. This sychronization applies to the whole site! | | _**<content>**_ | _<empty>_ | Arbitrary number of tabs defined with the `tab` sub-shortcode. | {{% notice note %}} -When using tab views with different content sets, make sure to use a common `groupId` for equal sets of tabs but distinct `groupId` for different sets. +When using tab views with different content sets, make sure to use a common `groupid` for equal sets of tabs but distinct `groupid` for different sets. -The tab selection is restored automatically based on the `groupId` and if it cannot find a tab item because it came from the `'default'` group on a different page then the first tab is selected instead. +The tab selection is restored automatically based on the `groupid` and if it cannot find a tab item because it came from the `'default'` group on a different page then the first tab is selected instead. {{% /notice %}} ## Examples -### Distinct `groupId` +### Distinct `groupid` ````go -{{}} +{{}} {{%/* tab name="json" */%}} ```json { @@ -105,7 +105,7 @@ Hello = World {{}} ```` -{{< tabs groupId="tabs-example-config" >}} +{{< tabs groupid="tabs-example-config" >}} {{% tab name="json" %}} ```json { @@ -125,12 +125,12 @@ Hello = World {{% /tab %}} {{< /tabs >}} -### Non-Distinct `groupId` +### Non-Distinct `groupid` See what happens to this tab view if you select **properties** tab from the previous example. ````go -{{}} +{{}} {{%/* tab name="json" */%}} ```json { @@ -146,7 +146,7 @@ See what happens to this tab view if you select **properties** tab from the prev {{}} ```` -{{< tabs groupId="tabs-example-config" >}} +{{< tabs groupid="tabs-example-config" >}} {{% tab name="json" %}} ```json { diff --git a/layouts/partials/shortcodes/tabs.html b/layouts/partials/shortcodes/tabs.html index c13c9c969c..4895eeff6c 100644 --- a/layouts/partials/shortcodes/tabs.html +++ b/layouts/partials/shortcodes/tabs.html @@ -1,21 +1,21 @@ {{- $context := .context }} {{- $tabs := .tabs | default slice }} -{{- $groupId := .groupId | default "default" }} +{{- $groupid := .groupid | default "default" }} {{- with $context }}
{{- range $idx, $tab := $tabs }} {{- end }}
{{- range $idx, $tab := $tabs }} -
+
{{ .content | safeHTML }}
{{- end }} diff --git a/layouts/shortcodes/tabs.html b/layouts/shortcodes/tabs.html index 3f2a312383..7fbe50ee08 100644 --- a/layouts/shortcodes/tabs.html +++ b/layouts/shortcodes/tabs.html @@ -1,6 +1,6 @@ {{- partial "shortcodes/tabs.html" (dict "context" . "content" .Inner - "groupId" (.Get "groupId") + "groupid" ((.Get "groupid") | default (.Get "groupId")) "tabs" (.Scratch.Get "tabs") ) }} \ No newline at end of file