mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
docs: sphinx-static: switchers.js.in: fix broken switcher for branches
The switcher expects URL subpath to match the "release" used by sphinx to build the documentation. Branches, however, are put in a subpath after their name (e.g. dunfell) while sphinx sets the "release" to X.Y.999. This means the switcher cannot replace correctly the path to switch between releases/versions. Let set_versions.py inject the list of release names into the switchers.js.in file so it can check whether the subpath is one of the release names in which case it needs to be stripped. Cc: Quentin Schulz <foss+yocto@0leil.net> (From yocto-docs rev: 5ef3d129b8d0d8ae98a694103930988a46285525) Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
63e717738f
commit
ee6718fe08
|
@ -203,6 +203,9 @@ versions = []
|
|||
with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switchers.js", "w") as w:
|
||||
lines = r.readlines()
|
||||
for line in lines:
|
||||
if "ALL_RELEASES_PLACEHOLDER" in line:
|
||||
w.write(str(list(release_series.keys())))
|
||||
continue
|
||||
if "VERSIONS_PLACEHOLDER" in line:
|
||||
w.write(" 'dev': { 'title': 'dev (%s)', 'obsolete': false,},\n" % release_series[devbranch])
|
||||
for branch in activereleases + ([ourseries] if ourseries not in activereleases else []):
|
||||
|
|
|
@ -9,6 +9,10 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
var all_releases =
|
||||
ALL_RELEASES_PLACEHOLDER
|
||||
;
|
||||
|
||||
var switcher_versions = {
|
||||
VERSIONS_PLACEHOLDER
|
||||
};
|
||||
|
@ -155,6 +159,14 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b
|
|||
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, ""), "");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user