From 2483de17834e42b046ede6abe51d42f60caafba6 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Fri, 14 Apr 2023 19:38:41 +0100 Subject: [PATCH] Add currentPatchVersion type to skew shortcode You can now use {{< skew currentPatchVersion >}} as a Hugo shortcode, and it will render to the patch SemVer for the minor release that is being documented. --- layouts/shortcodes/skew.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/layouts/shortcodes/skew.html b/layouts/shortcodes/skew.html index 901a745ee14..de447aba0c2 100644 --- a/layouts/shortcodes/skew.html +++ b/layouts/shortcodes/skew.html @@ -77,6 +77,25 @@ {{- $currentVersionAddMinor -}} {{- end -}} + +{{- if eq $version "currentPatchVersion" -}} + {{- $seenPatchVersionInfoCount := 0 }} + {{- range $releaseInfo := .Site.Data.releases.schedule.schedules -}} + {{- if eq $currentVersion ( printf "%.2f" $releaseInfo.release ) -}} + {{- range $patchReleaseInfo := $releaseInfo.previousPatches -}} + {{- if eq $seenPatchVersionInfoCount 0 -}} + {{- $patchReleaseInfo.release -}} + {{- end -}} + {{- $seenPatchVersionInfoCount = add $seenPatchVersionInfoCount 1 -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- if eq $seenPatchVersionInfoCount 0 -}} + + {{- printf "%.2f.0" $currentVersion -}} + {{- end -}} +{{- end -}} +