You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2021/05/21 11:51:49 UTC
[camel-website] branch main updated: fix: last N of kind versions
not shown
This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/main by this push:
new 5b78f62 fix: last N of kind versions not shown
5b78f62 is described below
commit 5b78f62a301a39224466d4d0cf59a723add58d2b
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Fri May 21 13:51:13 2021 +0200
fix: last N of kind versions not shown
The logic for showing up to N last versions of a certain kind worked
until we had more than 2 of minor versions of a LTS release. Instead of
indexing first 2 (or N) versions this ranges over all versions and stops
adding when the required number (2/N) has been reached.
---
layouts/partials/releases/downloads.html | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/layouts/partials/releases/downloads.html b/layouts/partials/releases/downloads.html
index fe98912..69bc232 100644
--- a/layouts/partials/releases/downloads.html
+++ b/layouts/partials/releases/downloads.html
@@ -17,22 +17,26 @@
{{ range $kind := $.Category.kinds }}
{{ if eq $kind.filter "latest" }}
{{/* there can be only single latest version, and we sort by version to find it, there could be newer by date versions that are not the latest, e.g. patching a legacy or lts release */}}
- {{ $released_versions := partial "releases/version_sort.html" ($category_releases.ByParam "version") }}
+ {{ $released_versions := partial "releases/version_sort.html" $category_releases }}
{{ $version := (index $released_versions 0).Param "version" }}
{{ $versions = $versions | append (dict $kind.name $version) }}
{{ else }}
{{/* non-latest versions we need to sort by date of release */}}
- {{ $released_versions := partial "releases/version_sort.html" ($category_releases.ByParam "date") }}
+ {{ $released_versions := partial "releases/version_sort.html" $category_releases }}
{{ if $kind.last }}
- {{/* we need to feature more than one of this kind: 0..last - 1*/}}
+ {{/* we need to feature more than one of this kind, up to $kind.last */}}
{{/* if we need to feature more than one, we don't want the last N of the same major.minor, we want previous N major.minor versions */}}
{{ $last_major_minor := "" }}
- {{ range $idx := (seq 0 (sub $kind.last 1)) }}
- {{ $version := (index (where $released_versions ".Params.kind" $kind.filter) $idx).Param "version" }}
+ {{/* number of versions of this kind found so far */}}
+ {{ $no_last := 0 }}
+ {{/* take only this kind into consideration */}}
+ {{ range $release := where $released_versions ".Params.kind" $kind.filter }}
+ {{ $version := $release.Param "version" }}
{{ $major_minor := replaceRE "\\.\\d+$" "" $version }}
- {{ if ne $last_major_minor $major_minor }}
+ {{ if (and (ne $last_major_minor $major_minor) (lt $no_last $kind.last)) }}
{{ $versions = $versions | append (dict $kind.name $version) }}
+ {{ $no_last = $no_last | add 1 }}
{{ end }}
{{ $last_major_minor = $major_minor }}
{{ end }}