Skip to content

Commit

Permalink
Deploying to gh-pages from @ cca35cf 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
reginald-mclean committed Nov 5, 2024
1 parent 7ad2d7d commit 9e22b99
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions _static/versioning/versioning_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,33 @@
});

const sortVersions = (a, b) => {
// Alpha versions
if (a.includes("a")) return 1;
if (b.includes("a")) return -1;
if (a.replace("v", "") > b.replace("v", ""))
return -1
else if (a.replace("v", "") < b.replace("v", ""))
return 1
else
return 0
const innerA = a.replace("v", "");
const innerB = b.replace("v", "");

if (innerA.match(/[a-z]/) && !innerB.match(/[a-z]/)) return 1;
if (!innerA.match(/[a-z]/) && innerB.match(/[a-z]/)) return -1;

const splittedInnerA = innerA.split("");
const splittedInnerB = innerB.split("");

while (splittedInnerA.length && splittedInnerB.length) {
const charA = splittedInnerA.shift();
const charB = splittedInnerB.shift();

if (charA === charB) continue;
else if (charA === ".") return 1;
else if (charB === ".") return -1;
else if (charA.match(/[0-9]/) && charB.match(/[0-9]/)) {
return Number(charB) - Number(charA);
} else {
if (charA < charB) return 1;
else if (charA > charB) return -1;
else return 0;
}
}
if (innerA < innerB) return 1;
else if (innerA > innerB) return -1;
else return 0;
}

if ((githubUser !== null && githubUser !== "") || (repo !== null && repo !== "")) {
Expand Down Expand Up @@ -204,4 +222,4 @@
console.error("Invalid versioning configuration");
}
</script>
</div>
</div>

0 comments on commit 9e22b99

Please sign in to comment.