[1/1,transition] Makefile: Use switchers generated from master

Message ID 20220319152803.1110539-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/1,transition] Makefile: Use switchers generated from master | expand

Commit Message

Richard Purdie March 19, 2022, 3:28 p.m. UTC
This allows an improved and custmomised switcher for each release
showing the current doc version, the latest in that series and the
latest releases for the project overall.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 documentation/.gitignore                 |   1 +
 documentation/Makefile                   |   9 +-
 documentation/sphinx-static/switchers.js | 233 -----------------------
 3 files changed, 9 insertions(+), 234 deletions(-)
 delete mode 100644 documentation/sphinx-static/switchers.js

Comments

Michael Opdenacker March 21, 2022, 9:39 a.m. UTC | #1
On 3/19/22 16:28, Richard Purdie wrote:
> This allows an improved and custmomised switcher for each release
> showing the current doc version, the latest in that series and the
> latest releases for the project overall.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  documentation/.gitignore                 |   1 +
>  documentation/Makefile                   |   9 +-
>  documentation/sphinx-static/switchers.js | 233 -----------------------
>  3 files changed, 9 insertions(+), 234 deletions(-)
>  delete mode 100644 documentation/sphinx-static/switchers.js


Looks good to me.
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Thanks :)

Michael.
Quentin Schulz March 21, 2022, 5:28 p.m. UTC | #2
Hi Richard,

On 3/19/22 16:28, Richard Purdie wrote:
> This allows an improved and custmomised switcher for each release
> showing the current doc version, the latest in that series and the
> latest releases for the project overall.
> 

Not sure to understand the reason for this patch?

We anyway cannot fix already-tagged releases, for which 
yocto-autobuilder-helper will checkout the script and handle changes as 
required, why would the transition branch require something 
different/specific?

Cheers,
Quentin

> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   documentation/.gitignore                 |   1 +
>   documentation/Makefile                   |   9 +-
>   documentation/sphinx-static/switchers.js | 233 -----------------------
>   3 files changed, 9 insertions(+), 234 deletions(-)
>   delete mode 100644 documentation/sphinx-static/switchers.js
> 
> diff --git a/documentation/.gitignore b/documentation/.gitignore
> index c1e43630d..f7d91141a 100644
> --- a/documentation/.gitignore
> +++ b/documentation/.gitignore
> @@ -1,2 +1,3 @@
>   _build/
>   sphinx/__pycache__/
> +sphinx-static/switchers.js
> \ No newline at end of file
> diff --git a/documentation/Makefile b/documentation/Makefile
> index 564a906e2..433e880c4 100644
> --- a/documentation/Makefile
> +++ b/documentation/Makefile
> @@ -8,9 +8,16 @@ TRANSITIONS   = $(sort $(patsubst $(SOURCEDIR)/transition/%/index.rst,%,$(wildca
>   
>   .PHONY: Makefile publish transition clean $(TRANSITIONS)
>   
> +sphinx-static/switchers.js.in:
> +	git checkout master sphinx-static/switchers.js.in
> +
> +set_versions.py:
> +	git checkout master set_versions.py
> +
>   transition: $(TRANSITIONS)
>   
> -$(TRANSITIONS):
> +$(TRANSITIONS): sphinx-static/switchers.js.in set_versions.py
> +	./set_versions.py $@
>   	@$(SPHINXBUILD) -M html "$(SOURCEDIR)"/transition/$@/ "$(BUILDDIR)"/$@ $(SPHINXOPTS) $(O) -c "$(SOURCEDIR)"
>   
>   publish: transition
> diff --git a/documentation/sphinx-static/switchers.js b/documentation/sphinx-static/switchers.js
> deleted file mode 100644
> index e52032ead..000000000
> --- a/documentation/sphinx-static/switchers.js
> +++ /dev/null
> @@ -1,233 +0,0 @@
> -(function() {
> -  'use strict';
> -
> -  var all_versions = {
> -    'dev': 'dev (3.2)',
> -    '3.1.4': '3.1.4',
> -    '3.0.4': '3.0.4',
> -    '2.7.4': '2.7.4',
> -  };
> -
> -  var all_doctypes = {
> -      'single': 'Individual Webpages',
> -      'mega': "All-in-one 'Mega' Manual",
> -  };
> -
> -  // Simple version comparision
> -  // Return 1 if a > b
> -  // Return -1 if a < b
> -  // Return 0 if a == b
> -  function ver_compare(a, b) {
> -    if (a == "dev") {
> -       return 1;
> -    }
> -
> -    if (a === b) {
> -       return 0;
> -    }
> -
> -    var a_components = a.split(".");
> -    var b_components = b.split(".");
> -
> -    var len = Math.min(a_components.length, b_components.length);
> -
> -    // loop while the components are equal
> -    for (var i = 0; i < len; i++) {
> -        // A bigger than B
> -        if (parseInt(a_components[i]) > parseInt(b_components[i])) {
> -            return 1;
> -        }
> -
> -        // B bigger than A
> -        if (parseInt(a_components[i]) < parseInt(b_components[i])) {
> -            return -1;
> -        }
> -    }
> -
> -    // If one's a prefix of the other, the longer one is greater.
> -    if (a_components.length > b_components.length) {
> -        return 1;
> -    }
> -
> -    if (a_components.length < b_components.length) {
> -        return -1;
> -    }
> -
> -    // Otherwise they are the same.
> -    return 0;
> -  }
> -
> -  function build_version_select(current_series, current_version) {
> -    var buf = ['<select>'];
> -
> -    $.each(all_versions, function(version, title) {
> -      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>');
> -      } else {
> -        buf.push('<option value="' + version + '">' + title + '</option>');
> -      }
> -    });
> -
> -    buf.push('</select>');
> -    return buf.join('');
> -  }
> -
> -  function build_doctype_select(current_doctype) {
> -    var buf = ['<select>'];
> -
> -    $.each(all_doctypes, function(doctype, title) {
> -      if (doctype == current_doctype)
> -        buf.push('<option value="' + doctype + '" selected="selected">' +
> -                 all_doctypes[current_doctype] + '</option>');
> -      else
> -        buf.push('<option value="' + doctype + '">' + title + '</option>');
> -    });
> -    if (!(current_doctype in all_doctypes)) {
> -        // In case we're browsing a doctype that is not yet in all_doctypes.
> -        buf.push('<option value="' + current_doctype + '" selected="selected">' +
> -                 current_doctype + '</option>');
> -        all_doctypes[current_doctype] = current_doctype;
> -    }
> -    buf.push('</select>');
> -    return buf.join('');
> -  }
> -
> -  function navigate_to_first_existing(urls) {
> -    // Navigate to the first existing URL in urls.
> -    var url = urls.shift();
> -
> -    // Web browsers won't redirect file:// urls to file urls using ajax but
> -    // its useful for local testing
> -    if (url.startsWith("file://")) {
> -      window.location.href = url;
> -      return;
> -    }
> -
> -    if (urls.length == 0) {
> -      window.location.href = url;
> -      return;
> -    }
> -    $.ajax({
> -      url: url,
> -      success: function() {
> -        window.location.href = url;
> -      },
> -      error: function() {
> -        navigate_to_first_existing(urls);
> -      }
> -    });
> -  }
> -
> -  function get_docroot_url() {
> -    var url = window.location.href;
> -    var root = DOCUMENTATION_OPTIONS.URL_ROOT;
> -
> -    var urlarray = url.split('/');
> -    // Trim off anything after '/'
> -    urlarray.pop();
> -    var depth = (root.match(/\.\.\//g) || []).length;
> -    for (var i = 0; i < depth; i++) {
> -      urlarray.pop();
> -    }
> -
> -    return urlarray.join('/') + '/';
> -  }
> -
> -  function on_version_switch() {
> -    var selected_version = $(this).children('option:selected').attr('value');
> -    var url = window.location.href;
> -    var current_version = DOCUMENTATION_OPTIONS.VERSION;
> -    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") {
> -        var new_url = docroot + new_versionpath + url.replace(docroot, "");
> -        var fallback_url = docroot + new_versionpath;
> -    } else {
> -        var new_url = url.replace('/' + current_version + '/', '/' + new_versionpath);
> -        var fallback_url = new_url.replace(url.replace(docroot, ""), "");
> -    }
> -
> -    console.log(get_docroot_url())
> -    console.log(url + " to url " + new_url);
> -    console.log(url + " to fallback " + fallback_url);
> -
> -    if (new_url != url) {
> -      navigate_to_first_existing([
> -        new_url,
> -        fallback_url,
> -        'https://urldefense.proofpoint.com/v2/url?u=https-3A__www.yoctoproject.org_docs_&d=DwIDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=isfW44ZF5kuhyY44oJjXbmrJNH56s7PcZf_DXMb5wvx3gOochEh79xvv4mCES4kQ&s=zUSdVp19IAPikzuZt7DkZZkEB7r83pTjRI3cpZI80as&e= ',
> -      ]);
> -    }
> -  }
> -
> -  function on_doctype_switch() {
> -    var selected_doctype = $(this).children('option:selected').attr('value');
> -    var url = window.location.href;
> -    if (selected_doctype == 'mega') {
> -      var docroot = get_docroot_url()
> -      var current_version = DOCUMENTATION_OPTIONS.VERSION;
> -      // Assume manuals before 3.2 are using old docbook mega-manual
> -      if (ver_compare(current_version, "3.2") < 0) {
> -        var new_url = docroot + "mega-manual/mega-manual.html";
> -      } else {
> -        var new_url = docroot + "singleindex.html";
> -      }
> -    } else {
> -      var new_url = url.replace("singleindex.html", "index.html")
> -    }
> -
> -    if (new_url != url) {
> -      navigate_to_first_existing([
> -        new_url,
> -        'https://urldefense.proofpoint.com/v2/url?u=https-3A__www.yoctoproject.org_docs_&d=DwIDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=isfW44ZF5kuhyY44oJjXbmrJNH56s7PcZf_DXMb5wvx3gOochEh79xvv4mCES4kQ&s=zUSdVp19IAPikzuZt7DkZZkEB7r83pTjRI3cpZI80as&e= ',
> -      ]);
> -    }
> -  }
> -
> -  // Returns the current doctype based upon the url
> -  function doctype_segment_from_url(url) {
> -    if (url.includes("singleindex") || url.includes("mega-manual"))
> -      return "mega";
> -    return "single";
> -  }
> -
> -  $(document).ready(function() {
> -    var release = DOCUMENTATION_OPTIONS.VERSION;
> -    var current_doctype = doctype_segment_from_url(window.location.href);
> -    var current_series = release.substr(0, 3);
> -    var version_select = build_version_select(current_series, release);
> -
> -    $('.version_switcher_placeholder').html(version_select);
> -    $('.version_switcher_placeholder select').bind('change', on_version_switch);
> -
> -    var doctype_select = build_doctype_select(current_doctype);
> -
> -    $('.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) {
> -        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');
> -        }
> -      });
> -    }
> -  });
> -})();
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#2644): https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_g_docs_message_2644&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=isfW44ZF5kuhyY44oJjXbmrJNH56s7PcZf_DXMb5wvx3gOochEh79xvv4mCES4kQ&s=c4JwO4ulmWCUvNf7cVgYgdb-hJY955ob7lZroYQalqc&e=
> Mute This Topic: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_mt_89890470_6293953&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=isfW44ZF5kuhyY44oJjXbmrJNH56s7PcZf_DXMb5wvx3gOochEh79xvv4mCES4kQ&s=fkx7Ua5fATrcGS7x9mKIhwjmEZYXo9ZKh0J62bUitSs&e=
> Group Owner: docs+owner@lists.yoctoproject.org
> Unsubscribe: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_g_docs_unsub&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=isfW44ZF5kuhyY44oJjXbmrJNH56s7PcZf_DXMb5wvx3gOochEh79xvv4mCES4kQ&s=K5AsX3XjfLfuAVh9csLO14g9CT8R-wrL9UG1npdX4A8&e=  [quentin.schulz@theobroma-systems.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie March 21, 2022, 5:33 p.m. UTC | #3
On Mon, 2022-03-21 at 18:28 +0100, Quentin Schulz wrote:
> Hi Richard,
> 
> On 3/19/22 16:28, Richard Purdie wrote:
> > This allows an improved and custmomised switcher for each release
> > showing the current doc version, the latest in that series and the
> > latest releases for the project overall.
> > 
> 
> Not sure to understand the reason for this patch?

For every other docs branch we can run set_versions.py once and have the correct
information in switchers.js. For transitions, we have multiple runs of the
documentation generation and we want to customise switchers.js in each case.
This is so we can show the current version, and the current release series
latest version which allows the switcher to work properly.  To do that, it is
easiest just to fix the transitions branch to handle that.

Cheers,

Richard
Quentin Schulz March 22, 2022, 1:34 p.m. UTC | #4
Hi Richard,

On 3/21/22 18:33, Richard Purdie wrote:
> On Mon, 2022-03-21 at 18:28 +0100, Quentin Schulz wrote:
>> Hi Richard,
>>
>> On 3/19/22 16:28, Richard Purdie wrote:
>>> This allows an improved and custmomised switcher for each release
>>> showing the current doc version, the latest in that series and the
>>> latest releases for the project overall.
>>>
>>
>> Not sure to understand the reason for this patch?
> 
> For every other docs branch we can run set_versions.py once and have the correct
> information in switchers.js. For transitions, we have multiple runs of the
> documentation generation and we want to customise switchers.js in each case.
> This is so we can show the current version, and the current release series
> latest version which allows the switcher to work properly.  To do that, it is
> easiest just to fix the transitions branch to handle that.
> 

Makes perfect sense, would have loved to have this in the commit log :)

Reviewed-by: Quentin Schulz <foss+yocto@0leil.net>

Thanks!
Quentin
Richard Purdie March 22, 2022, 2:29 p.m. UTC | #5
On Tue, 2022-03-22 at 14:34 +0100, Quentin Schulz wrote:
> Hi Richard,
> 
> On 3/21/22 18:33, Richard Purdie wrote:
> > On Mon, 2022-03-21 at 18:28 +0100, Quentin Schulz wrote:
> > > Hi Richard,
> > > 
> > > On 3/19/22 16:28, Richard Purdie wrote:
> > > > This allows an improved and custmomised switcher for each release
> > > > showing the current doc version, the latest in that series and the
> > > > latest releases for the project overall.
> > > > 
> > > 
> > > Not sure to understand the reason for this patch?
> > 
> > For every other docs branch we can run set_versions.py once and have the correct
> > information in switchers.js. For transitions, we have multiple runs of the
> > documentation generation and we want to customise switchers.js in each case.
> > This is so we can show the current version, and the current release series
> > latest version which allows the switcher to work properly.  To do that, it is
> > easiest just to fix the transitions branch to handle that.
> > 
> 
> Makes perfect sense, would have loved to have this in the commit log :)

I did try and say that, just not very clearly. I've added to the commit log as
it hasn't merged yet.

Cheers,

Richard

Patch

diff --git a/documentation/.gitignore b/documentation/.gitignore
index c1e43630d..f7d91141a 100644
--- a/documentation/.gitignore
+++ b/documentation/.gitignore
@@ -1,2 +1,3 @@ 
 _build/
 sphinx/__pycache__/
+sphinx-static/switchers.js
\ No newline at end of file
diff --git a/documentation/Makefile b/documentation/Makefile
index 564a906e2..433e880c4 100644
--- a/documentation/Makefile
+++ b/documentation/Makefile
@@ -8,9 +8,16 @@  TRANSITIONS   = $(sort $(patsubst $(SOURCEDIR)/transition/%/index.rst,%,$(wildca
 
 .PHONY: Makefile publish transition clean $(TRANSITIONS)
 
+sphinx-static/switchers.js.in:
+	git checkout master sphinx-static/switchers.js.in
+
+set_versions.py:
+	git checkout master set_versions.py
+
 transition: $(TRANSITIONS)
 
-$(TRANSITIONS):
+$(TRANSITIONS): sphinx-static/switchers.js.in set_versions.py
+	./set_versions.py $@
 	@$(SPHINXBUILD) -M html "$(SOURCEDIR)"/transition/$@/ "$(BUILDDIR)"/$@ $(SPHINXOPTS) $(O) -c "$(SOURCEDIR)"
 
 publish: transition
diff --git a/documentation/sphinx-static/switchers.js b/documentation/sphinx-static/switchers.js
deleted file mode 100644
index e52032ead..000000000
--- a/documentation/sphinx-static/switchers.js
+++ /dev/null
@@ -1,233 +0,0 @@ 
-(function() {
-  'use strict';
-
-  var all_versions = {
-    'dev': 'dev (3.2)',
-    '3.1.4': '3.1.4',
-    '3.0.4': '3.0.4',
-    '2.7.4': '2.7.4',
-  };
-
-  var all_doctypes = {
-      'single': 'Individual Webpages',
-      'mega': "All-in-one 'Mega' Manual",
-  };
-
-  // Simple version comparision
-  // Return 1 if a > b
-  // Return -1 if a < b
-  // Return 0 if a == b
-  function ver_compare(a, b) {
-    if (a == "dev") {
-       return 1;
-    }
-
-    if (a === b) {
-       return 0;
-    }
-
-    var a_components = a.split(".");
-    var b_components = b.split(".");
-
-    var len = Math.min(a_components.length, b_components.length);
-
-    // loop while the components are equal
-    for (var i = 0; i < len; i++) {
-        // A bigger than B
-        if (parseInt(a_components[i]) > parseInt(b_components[i])) {
-            return 1;
-        }
-
-        // B bigger than A
-        if (parseInt(a_components[i]) < parseInt(b_components[i])) {
-            return -1;
-        }
-    }
-
-    // If one's a prefix of the other, the longer one is greater.
-    if (a_components.length > b_components.length) {
-        return 1;
-    }
-
-    if (a_components.length < b_components.length) {
-        return -1;
-    }
-
-    // Otherwise they are the same.
-    return 0;
-  }
-
-  function build_version_select(current_series, current_version) {
-    var buf = ['<select>'];
-
-    $.each(all_versions, function(version, title) {
-      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>');
-      } else {
-        buf.push('<option value="' + version + '">' + title + '</option>');
-      }
-    });
-
-    buf.push('</select>');
-    return buf.join('');
-  }
-
-  function build_doctype_select(current_doctype) {
-    var buf = ['<select>'];
-
-    $.each(all_doctypes, function(doctype, title) {
-      if (doctype == current_doctype)
-        buf.push('<option value="' + doctype + '" selected="selected">' +
-                 all_doctypes[current_doctype] + '</option>');
-      else
-        buf.push('<option value="' + doctype + '">' + title + '</option>');
-    });
-    if (!(current_doctype in all_doctypes)) {
-        // In case we're browsing a doctype that is not yet in all_doctypes.
-        buf.push('<option value="' + current_doctype + '" selected="selected">' +
-                 current_doctype + '</option>');
-        all_doctypes[current_doctype] = current_doctype;
-    }
-    buf.push('</select>');
-    return buf.join('');
-  }
-
-  function navigate_to_first_existing(urls) {
-    // Navigate to the first existing URL in urls.
-    var url = urls.shift();
-
-    // Web browsers won't redirect file:// urls to file urls using ajax but
-    // its useful for local testing
-    if (url.startsWith("file://")) {
-      window.location.href = url;
-      return;
-    }
-
-    if (urls.length == 0) {
-      window.location.href = url;
-      return;
-    }
-    $.ajax({
-      url: url,
-      success: function() {
-        window.location.href = url;
-      },
-      error: function() {
-        navigate_to_first_existing(urls);
-      }
-    });
-  }
-
-  function get_docroot_url() {
-    var url = window.location.href;
-    var root = DOCUMENTATION_OPTIONS.URL_ROOT;
-
-    var urlarray = url.split('/');
-    // Trim off anything after '/'
-    urlarray.pop();
-    var depth = (root.match(/\.\.\//g) || []).length;
-    for (var i = 0; i < depth; i++) {
-      urlarray.pop();
-    }
-
-    return urlarray.join('/') + '/';
-  }
-
-  function on_version_switch() {
-    var selected_version = $(this).children('option:selected').attr('value');
-    var url = window.location.href;
-    var current_version = DOCUMENTATION_OPTIONS.VERSION;
-    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") {
-        var new_url = docroot + new_versionpath + url.replace(docroot, "");
-        var fallback_url = docroot + new_versionpath;
-    } else {
-        var new_url = url.replace('/' + current_version + '/', '/' + new_versionpath);
-        var fallback_url = new_url.replace(url.replace(docroot, ""), "");
-    }
-
-    console.log(get_docroot_url())
-    console.log(url + " to url " + new_url);
-    console.log(url + " to fallback " + fallback_url);
-
-    if (new_url != url) {
-      navigate_to_first_existing([
-        new_url,
-        fallback_url,
-        'https://www.yoctoproject.org/docs/',
-      ]);
-    }
-  }
-
-  function on_doctype_switch() {
-    var selected_doctype = $(this).children('option:selected').attr('value');
-    var url = window.location.href;
-    if (selected_doctype == 'mega') {
-      var docroot = get_docroot_url()
-      var current_version = DOCUMENTATION_OPTIONS.VERSION;
-      // Assume manuals before 3.2 are using old docbook mega-manual
-      if (ver_compare(current_version, "3.2") < 0) {
-        var new_url = docroot + "mega-manual/mega-manual.html";
-      } else {
-        var new_url = docroot + "singleindex.html";
-      }
-    } else {
-      var new_url = url.replace("singleindex.html", "index.html")
-    }
-
-    if (new_url != url) {
-      navigate_to_first_existing([
-        new_url,
-        'https://www.yoctoproject.org/docs/',
-      ]);
-    }
-  }
-
-  // Returns the current doctype based upon the url
-  function doctype_segment_from_url(url) {
-    if (url.includes("singleindex") || url.includes("mega-manual"))
-      return "mega";
-    return "single";
-  }
-
-  $(document).ready(function() {
-    var release = DOCUMENTATION_OPTIONS.VERSION;
-    var current_doctype = doctype_segment_from_url(window.location.href);
-    var current_series = release.substr(0, 3);
-    var version_select = build_version_select(current_series, release);
-
-    $('.version_switcher_placeholder').html(version_select);
-    $('.version_switcher_placeholder select').bind('change', on_version_switch);
-
-    var doctype_select = build_doctype_select(current_doctype);
-
-    $('.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) {
-        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');
-        }
-      });
-    }
-  });
-})();