Selaa lähdekoodia

sphinx-static/switchers.js.in: do not refer to URL_ROOT anymore

This variable was removed from the Sphinx-generated
documentation_options.js, thus breaking the current implementation of
our switchers.js. Like searchtools.js, which is also generated by
Sphinx, use document.documentElement.dataset.content_root as a
replacement.

To be backwards-compatible to get one or the other.

(From yocto-docs rev: 13caec1386708d8609dff5f42956d2329a074f37)

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Antonin Godard 6 kuukautta sitten
vanhempi
commit
a0f93fed3a
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      documentation/sphinx-static/switchers.js.in

+ 6 - 0
documentation/sphinx-static/switchers.js.in

@@ -133,7 +133,13 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b
 
   function get_docroot_url() {
     var url = window.location.href;
+    // Try to get the variable from documentation_options.js
     var root = DOCUMENTATION_OPTIONS.URL_ROOT;
+    if (root == null) {
+      // In recent versions of Sphinx, URL_ROOT was removed from
+      // documentation_options.js, so get it like searchtools.js does.
+      root = document.documentElement.dataset.content_root;
+    }
 
     var urlarray = url.split('/');
     // Trim off anything after '/'