#1000136 emscripten: Update theme for new Sphinx and drop dh_sphinxdoc override

Package:
src:emscripten
Source:
emscripten
Submitter:
Jonas Smedegaard
Date:
2024-11-21 17:36:11 UTC
Severity:
normal
Tags:
#1000136#5
Date:
2021-11-18 13:06:22 UTC
From:
To:
dh_sphinxdoc worked fine with emscripten 2.0.26~dfsg-4 at the time it
was released, but since then it fails:

dh_sphinxdoc: error: DOCUMENTATION_OPTIONS does not define URL_ROOT

 - Jonas
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEn+Ppw2aRpp/1PMaELHwxRsGgASEFAmGWT8oACgkQLHwxRsGg
ASFccg//QwA3fYeqWdLgxNq+Q1r3TwIyNzSZoSE1bN/EmAxL9bhsOIZ7Wk79JP9r
9GQ/bnF3Wh7Umj3DlG9JFGUH9vXypaNy4aMiAagRdAovuMvVxjSRF6eCTK8spTLR
XC6Or2ojgY7AMfW6z0fzvWH4sSfppmsUyr9wbbr3mroGFmvEdd4fmkzPnAGAC3EM
hc8sSr5wKUUvFXBUo4nvWahen68dxCeH9OJ8keB4xEC2+UXdKagPyWlltgU5zixz
W+jkB94AD1du76f2VMHpm8jyY/kXDvivxKQV9C6Ie/+brCzS/98enhx7B7cXUphn
99aYS8IsIwZRt6LWi1c6+setJz1YpYOlYgYkZONCmoWOUbSj5XCXJmZdr/m6VyHY
xFgUk1VByJJOn3nIUmQhju+hGur3IA4dtvplL+3KBH3r9UQPTQvqsWFG/t4lMqYk
ZI8+HdjLwGDrVDikCcqF3uiZJm+ck29pAEPELnPmNj4WqhUZY0IoLk1XfWCp5LlO
8kpv05elqDfg7Ix2jMjHSQXifsSVZ6wJIdkaSVP6pbbejepDw5enFm6O+Tpt1a58
1adXq9rVV1LDKQpLU25vycUXIzW4fJ8Jn6F7q8rJyVVAd5qO2tTSD3M1Kqr1zwiS
oVaJhNV3NO2SHRuxrBi1U/5KyYCffS1cdb/Mn1Mw9rGrhFBhw6k=
=U0EW
-----END PGP SIGNATURE-----

#1000136#10
Date:
2021-11-21 17:23:22 UTC
From:
To:
Hi Jonas!

Let's look at the generated search.html. It has this fragment:

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'2.0.26 (dev)',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            LINK_SUFFIX: '.html'
        };
    </script>
      <script type="text/javascript" src="_static/documentation_options.js"></script>

The first DOCUMENTATION_OPTIONS is good. However, documentation_options.js
overwrites it. That JS file has:

var DOCUMENTATION_OPTIONS = {
    URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
    VERSION: '2.0.26 (dev)',
    ...
}

But in search.html, there is no element with id="documentation_options", so
this does not work.

If you open search.html in a browser, you will see an error like this:

Uncaught TypeError: Cannot read properties of null (reading 'getAttribute')
    at documentation_options.js:2

Now, how to fix this. Emscripten uses emscripten_sphinx_rtd_theme, which is
a modification of sphinx-rtd-theme. The parent project sphinx-rtd-theme had
some fixes for Sphinx 4 between versions 0.5.1 and 1.0.0. In particular, see
this pull request:

https://github.com/readthedocs/sphinx_rtd_theme/pull/1123

Rebasing emscripten_sphinx_rtd_theme against the latest version of
sphinx-rtd-theme should fix this issue.

#1000136#15
Date:
2021-11-22 00:52:23 UTC
From:
To:
Quoting Dmitry Shachnev (2021-11-21 18:23:22)

Thanks a lot for a detailed and insightful response.

I'll pass that upstream to Emscripten developers.


 - Jonas