commit 6be61c5623d83e11da79d75c2577862f642231b1
parent f1860b371aa2af247c840f920e7f18eb1e9a3df4
Author: Lou Woell <lou.woell@posteo.de>
Date:   Sun, 14 Dec 2025 01:37:15 +0100

shortcode tabbed: fix margins

Diffstat:
Massets/css/tabbedContainer.scss | 2+-
Mlayouts/_shortcodes/tab.html | 20++++++++++----------
Mlayouts/_shortcodes/tabbed.html | 28++++++++++++++--------------
3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/assets/css/tabbedContainer.scss b/assets/css/tabbedContainer.scss @@ -14,7 +14,7 @@ border: 0px solid $background; border-bottom: 1px solid $background; text-decoration: none; - margin: 0 .1em 0 0; + margin: 0; font: inherit; font-weight: normal; font-size: 1em; diff --git a/layouts/_shortcodes/tab.html b/layouts/_shortcodes/tab.html @@ -1,11 +1,11 @@ -{{ if .Parent }} - {{ $name := trim (.Get "name") " " }} - {{ if not (.Parent.Scratch.Get "tabs") }} - {{ .Parent.Scratch.Set "tabs" slice }} - {{ end }} - {{ with .Inner }} - {{ $.Parent.Scratch.Add "tabs" (dict "name" $name "content" . ) }} - {{ end }} +{{ if .Parent -}} + {{- $name := trim (.Get "name") " " -}} + {{- if not (.Parent.Scratch.Get "tabs") -}} + {{- .Parent.Scratch.Set "tabs" slice -}} + {{- end -}} + {{- with .Inner }} + {{ $.Parent.Scratch.Add "tabs" (dict "name" $name "content" . ) -}} + {{ end }} {{ else }} - {{- errorf "[%s] %q: tab shortcode missing its parent" .Page.Path -}} -{{ end}} + {{- errorf "[%s] %q: tab shortcode missing its parent" .Page.Path -}} +{{- end }} diff --git a/layouts/_shortcodes/tabbed.html b/layouts/_shortcodes/tabbed.html @@ -1,17 +1,17 @@ {{ with .Inner }}{{/* don't do anything, just call it */}}{{ end }} <div class="tabContainer"> - <div class="tabBar" onclick="javascript:clickTab(event);"> - {{ range $idx, $tab := .Scratch.Get "tabs" }} - <button tabName="{{ .name }}" - class="tabLink {{ cond (eq $idx 0) "active" ""}}"> - {{ .name }}</button> - {{ end }} - </div> - <div class="tabs"> - {{ range $idx, $tab := .Scratch.Get "tabs" }} - <div class="tabContent" id="{{ .name }}" > - {{ .content }} - </div> - {{ end }} - </div> + <div class="tabBar" onclick="javascript:clickTab(event);"> + {{ range $idx, $tab := .Scratch.Get "tabs" -}} + <button tabName="{{ .name }}" + class="tabLink {{ cond (eq $idx 0) "active" ""}}"> + {{- .name }}</button> + {{- end }} + </div> + <div class="tabs"> + {{ range $idx, $tab := .Scratch.Get "tabs" -}} + <div class="tabContent" id="{{ .name }}"> + {{ .content }} + </div> + {{- end }} + </div> </div>