From 222b191fdde21ce8f2367c98e3b6b56154f07403 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 6 Jul 2023 06:21:47 -0400 Subject: [PATCH] tabpane: ensure each HTML elt has a unique ID (#1610) --- layouts/shortcodes/tab.html | 2 +- layouts/shortcodes/tabpane.html | 32 +++++++++++++------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/layouts/shortcodes/tab.html b/layouts/shortcodes/tab.html index d13e0338e3..3a9db6c171 100644 --- a/layouts/shortcodes/tab.html +++ b/layouts/shortcodes/tab.html @@ -13,7 +13,7 @@ {{ $header = (.Get 0) -}} {{ else -}} {{/* Prefill header if not given as named or unnamed parameter */ -}} - {{ $header = default (printf "Tab %v" ( add $.Ordinal 1)) (.Get "header") -}} + {{ $header = .Get "header" | default (printf "Tab %v" .Ordinal) -}} {{ end -}} {{/* store all tab info in dict tab */ -}} diff --git a/layouts/shortcodes/tabpane.html b/layouts/shortcodes/tabpane.html index beda48917e..d67567b08a 100644 --- a/layouts/shortcodes/tabpane.html +++ b/layouts/shortcodes/tabpane.html @@ -47,22 +47,16 @@ {{ $persistTab := and $deprecatedPersistLang (ne $persistKeyKind "none") -}} {{ $rightPane := default false ($.Get "right") -}} {{ $activeSet := false -}} -{{- /* Scratchpad gets populated through call to .Inner */ -}} -{{- .Inner -}} +{{/* Scratchpad gets populated through call to .Inner */ -}} +{{ .Inner -}} -{{ $persistKeyList := slice -}} {{ $duplicate := false -}} {{ $duplicateKey := "" -}} - -{{ $Ordinal := $.Ordinal -}} -{{ if ge hugo.Version "0.93.0" -}} - {{ if .Page.Store.Get "Ordinal" -}} - {{ $Ordinal = .Page.Store.Get "Ordinal" -}} - {{end -}} -{{ end -}} +{{ $persistKeyList := slice -}} +{{ $tabPaneOrdinal := .Ordinal -}} {{/* Nav tabs */ -}} -