Skip to content

Commit 2483de1

Browse files
author
Tim Bannister
committed
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.
1 parent ef66208 commit 2483de1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

layouts/shortcodes/skew.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@
7777
{{- $currentVersionAddMinor -}}
7878
{{- end -}}
7979

80+
<!-- output patch version for current release -->
81+
{{- if eq $version "currentPatchVersion" -}}
82+
{{- $seenPatchVersionInfoCount := 0 }}
83+
{{- range $releaseInfo := .Site.Data.releases.schedule.schedules -}}
84+
{{- if eq $currentVersion ( printf "%.2f" $releaseInfo.release ) -}}
85+
{{- range $patchReleaseInfo := $releaseInfo.previousPatches -}}
86+
{{- if eq $seenPatchVersionInfoCount 0 -}}
87+
{{- $patchReleaseInfo.release -}}
88+
{{- end -}}
89+
{{- $seenPatchVersionInfoCount = add $seenPatchVersionInfoCount 1 -}}
90+
{{- end -}}
91+
{{- end -}}
92+
{{- end -}}
93+
{{- if eq $seenPatchVersionInfoCount 0 -}}
94+
<!-- fallback patch version to .0 -->
95+
{{- printf "%.2f.0" $currentVersion -}}
96+
{{- end -}}
97+
{{- end -}}
98+
8099
<!--
81100
example shortcode use:
82101
- skew nextMinorVersion

0 commit comments

Comments
 (0)