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.
pull/40692/head
Tim Bannister 2023-04-14 19:38:41 +01:00
parent ef662086a6
commit 2483de1783
No known key found for this signature in database
GPG Key ID: 468B7071483F639F
1 changed files with 19 additions and 0 deletions

View File

@ -77,6 +77,25 @@
{{- $currentVersionAddMinor -}}
{{- end -}}
<!-- output patch version for current release -->
{{- 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 -}}
<!-- fallback patch version to .0 -->
{{- printf "%.2f.0" $currentVersion -}}
{{- end -}}
{{- end -}}
<!--
example shortcode use:
- skew nextMinorVersion