diff options
Diffstat (limited to 'documentation/sphinx-static')
-rw-r--r-- | documentation/sphinx-static/switchers.js.in (renamed from documentation/sphinx-static/switchers.js) | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/documentation/sphinx-static/switchers.js b/documentation/sphinx-static/switchers.js.in index 1e37b625a6..8c016859bc 100644 --- a/documentation/sphinx-static/switchers.js +++ b/documentation/sphinx-static/switchers.js.in @@ -1,13 +1,20 @@ +/* +NOTE FOR RELEASE MAINTAINERS: +This file only needs updating in the development release ("master" branch) +When documentation for stable releases is built, +the latest version from "master" is used +by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-build +*/ + (function() { 'use strict'; - var all_versions = { - 'dev': 'dev (3.4)', - '3.3.3': '3.3.3', - '3.2.4': '3.2.4', - '3.1.11': '3.1.11', - '3.0.4': '3.0.4', - '2.7.4': '2.7.4', + var all_releases = + ALL_RELEASES_PLACEHOLDER + ; + + var switcher_versions = { + VERSIONS_PLACEHOLDER }; var all_doctypes = { @@ -62,18 +69,15 @@ function build_version_select(current_series, current_version) { var buf = ['<select>']; - $.each(all_versions, function(version, title) { + $.each(switcher_versions, function(version, vers_data) { var series = version.substr(0, 3); if (series == current_series) { if (version == current_version) - buf.push('<option value="' + version + '" selected="selected">' + title + '</option>'); - else - buf.push('<option value="' + version + '">' + title + '</option>'); - - if (version != current_version) - buf.push('<option value="' + current_version + '" selected="selected">' + current_version + '</option>'); + buf.push('<option value="' + version + '" selected="selected">' + vers_data["title"] + '</option>'); + else + buf.push('<option value="' + version + '">' + vers_data["title"] + '</option>'); } else { - buf.push('<option value="' + version + '">' + title + '</option>'); + buf.push('<option value="' + version + '">' + vers_data["title"] + '</option>'); } }); @@ -149,14 +153,20 @@ var docroot = get_docroot_url() var new_versionpath = selected_version + '/'; - if (selected_version == "dev") - new_versionpath = ''; - // dev versions have no version prefix - if (current_version == "dev") { + // latest tag is also the default page (without version information) + if (docroot.endsWith(current_version + '/') == false) { var new_url = docroot + new_versionpath + url.replace(docroot, ""); var fallback_url = docroot + new_versionpath; } else { + // check for named releases (e.g. dunfell) in the subpath + $.each(all_releases, function(idx, release) { + if (docroot.endsWith('/' + release + '/')) { + current_version = release; + return false; + } + }); + var new_url = url.replace('/' + current_version + '/', '/' + new_versionpath); var fallback_url = new_url.replace(url.replace(docroot, ""), ""); } @@ -219,15 +229,20 @@ $('.doctype_switcher_placeholder').html(doctype_select); $('.doctype_switcher_placeholder select').bind('change', on_doctype_switch); - if (ver_compare(release, "3.1") < 0) { - $('#outdated-warning').html('Version ' + release + ' of the project is now considered obsolete, please select and use a more recent version'); - $('#outdated-warning').css('padding', '.5em'); - } else if (release != "dev") { - $.each(all_versions, function(version, title) { + if (release != "dev") { + $.each(switcher_versions, function(version, vers_data) { var series = version.substr(0, 3); - if (series == current_series && version != release) { - $('#outdated-warning').html('This document is for outdated version ' + release + ', you should select the latest release version in this series, ' + version + '.'); - $('#outdated-warning').css('padding', '.5em'); + if (series == current_series) { + if (version != release && release.endsWith('.999') == false) { + $('#outdated-warning').html('This document is for outdated version ' + release + ', you should select the latest release version in this series, ' + version + '.'); + $('#outdated-warning').css('padding', '.5em'); + return false; + } + if (vers_data["obsolete"]) { + $('#outdated-warning').html('Version ' + release + ' of the project is now considered obsolete, please select and use a more recent version'); + $('#outdated-warning').css('padding', '.5em'); + return false; + } } }); } |