diff --git a/docs/src/lang_switcher_postprocess.py b/docs/src/lang_switcher_postprocess.py index ecf4b645fcb..076280c4d4b 100644 --- a/docs/src/lang_switcher_postprocess.py +++ b/docs/src/lang_switcher_postprocess.py @@ -397,9 +397,11 @@ def _scaffold_sidebar(content, nav): """Section-less pages have no toc2 container; add the body classes and insert the sidebar div after the page

.""" def body_cls(m): - cls = m.group(1) - return m.group(0) if 'toc2' in cls else f']*?) class="([^"]*)"', body_cls, content, count=1) div = f'
{nav}
\n' return re.sub(r'(

\s*)', lambda m: m.group(1) + div, content, count=1, flags=re.DOTALL)