aboutsummaryrefslogtreecommitdiff
path: root/layouts/shortcodes/tab.html
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2019-05-22 14:37:31 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-05-22 14:37:55 +0200
commit0e6864f5aad8072fbdcecaad48c0151d231b1d25 (patch)
tree0c29f67a3222db94b1ca828dd8fe113606f7aa04 /layouts/shortcodes/tab.html
parent8f5aaee7aaf82a8939deb715483a1c45fe45efa8 (diff)
#39, Add expand and tabs shortcodes
Diffstat (limited to 'layouts/shortcodes/tab.html')
-rw-r--r--layouts/shortcodes/tab.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/shortcodes/tab.html b/layouts/shortcodes/tab.html
new file mode 100644
index 0000000..24520e7
--- /dev/null
+++ b/layouts/shortcodes/tab.html
@@ -0,0 +1,12 @@
+{{ if .Parent }}
+ {{ $name := .Get 0 }}
+ {{ $group := printf "tabs-%s" (.Parent.Get 0) }}
+
+ {{ if not (.Parent.Scratch.Get $group) }}
+ {{ .Parent.Scratch.Set $group slice }}
+ {{ end }}
+
+ {{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
+{{ else }}
+ {{- errorf "%q: tab shortcode must be inside tabs shortcode" .Page.Path -}}
+{{ end}}