diff mbox series

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

Message ID 20241106-pdf-xetex-v1-5-044eab7e77d3@bootlin.com
State Accepted
Headers show
Series Add support for PDF/Epub generation | expand

Commit Message

Antonin Godard Nov. 6, 2024, 7:48 a.m. UTC
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.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 documentation/sphinx-static/switchers.js.in | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Gyorgy Sarvari Oct. 6, 2025, 6:33 a.m. UTC | #1
It looks like that this patch got merged a while ago, but it seems that it is not online - at least not for Bitbake documentation. The top switcher is complaining that ' can't access property "match", root is undefined' , and when i inspect the issue, this commit seems to be missing from the js.
Antonin Godard Oct. 6, 2025, 7:55 a.m. UTC | #2
Hi Gyorgy,

On Mon Oct 6, 2025 at 8:33 AM CEST, Gyorgy Sarvari via lists.yoctoproject.org wrote:
> It looks like that this patch got merged a while ago, but it seems that it is
> not online - at least not for Bitbake documentation. The top switcher is
> complaining that ' can't access property "match", root is undefined' , and
> when i inspect the issue, this commit seems to be missing from the js.

BitBake's documentation is lacking its own proper switchers.js for now. I had a
plan to fix it but I am lacking the time to finish the work.

I just pushed my local work on bitbake-contrib if you want to take a look:
https://git.openembedded.org/bitbake-contrib/log/?h=contrib/agodard/fix-switchers-js

The idea is that bitbake should have its own menu with its own versions and
switchers code. Help appreciated!

Also from which version of bitbake did you get this issue? A link to BB's docs
that reproduces the issue would help.

Thanks for the report,
Antonin
Gyorgy Sarvari Oct. 6, 2025, 8 a.m. UTC | #3
On 10/6/25 09:55, Antonin Godard via lists.yoctoproject.org wrote:
> Hi Gyorgy,
>
> On Mon Oct 6, 2025 at 8:33 AM CEST, Gyorgy Sarvari via lists.yoctoproject.org wrote:
>> It looks like that this patch got merged a while ago, but it seems that it is
>> not online - at least not for Bitbake documentation. The top switcher is
>> complaining that ' can't access property "match", root is undefined' , and
>> when i inspect the issue, this commit seems to be missing from the js.
> BitBake's documentation is lacking its own proper switchers.js for now. I had a
> plan to fix it but I am lacking the time to finish the work.
>
> I just pushed my local work on bitbake-contrib if you want to take a look:
> https://git.openembedded.org/bitbake-contrib/log/?h=contrib/agodard/fix-switchers-js

Sure, will take a look.

> The idea is that bitbake should have its own menu with its own versions and
> switchers code. Help appreciated!
>
> Also from which version of bitbake did you get this issue? A link to BB's docs
> that reproduces the issue would help.

I got this error here:
https://docs.yoctoproject.org/bitbake/2.12/bitbake-user-manual/bitbake-user-manual-ref-variables.html
- I wanted to switch to the Kirkstone docs, but it disagreed with me.

>
> Thanks for the report,
> Antonin
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#7645): https://lists.yoctoproject.org/g/docs/message/7645
> Mute This Topic: https://lists.yoctoproject.org/mt/109421245/6084445
> Group Owner: docs+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/documentation/sphinx-static/switchers.js.in b/documentation/sphinx-static/switchers.js.in
index 8c016859bc80f03a6322bbea516864f75185c05a..b1c0812b53369b3c635e3466d84ca02f916d34f8 100644
--- a/documentation/sphinx-static/switchers.js.in
+++ b/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 '/'