Doc - Update deployed versions in custom.js

This commit is contained in:
Anthony MOI
2020-10-05 14:26:06 -04:00
committed by Anthony MOI
parent 59d66c6db8
commit 248586c8b9

View File

@ -4,19 +4,20 @@ const languages = [ "rust", "python", "node" ];
// Last stable version for each language
const stableVersion = {
"rust": "master",
"python": "master",
"python": "v0.9.0",
"node": "master"
}
// Dictionary doc folder to Label for each language
const versionMapping = {
"rust": {
"master": "master"
"master": "master",
},
"python": {
"master": "master"
"master": "master",
"v0.9.0": "v0.9.0"
},
"node": {
"master": "master"
"master": "master",
}
};
@ -113,7 +114,10 @@ function addVersionControl() {
const versionIndex = languageIndex + 1;
// If a version is specified, update it
if (parts[versionIndex] != "" && !parts[versionIndex].endsWith(".html")) {
version = parts[versionIndex];
// If `latest`, let's keep the default (should be the explicit latest version)
if (parts[versionIndex] != "latest") {
version = parts[versionIndex];
}
// Otherwise redirect to the latest (if not opening locally)
} else if (!parts[parts.length - 1].endsWith(".html")) {
return window.location.pathname = [language, version, parts.splice(versionIndex)].join("/");