From 03c73c4288f0aec6e71a461cc84cf94ff504be62 Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Thu, 18 Jan 2024 14:37:33 -0600 Subject: [PATCH] More speedups to section TOC rendering (#1642) * small refactor, comments, cleanup * docstring cleanups * mark as unsafe for parallel write * Update src/pydata_sphinx_theme/toctree.py --- src/pydata_sphinx_theme/__init__.py | 2 +- .../theme/pydata_sphinx_theme/layout.html | 4 +- src/pydata_sphinx_theme/toctree.py | 154 +++++++++++------- 3 files changed, 96 insertions(+), 64 deletions(-) diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index 8b40c20c4..83b007e3d 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -287,4 +287,4 @@ def setup(app: Sphinx) -> Dict[str, str]: # Include component templates app.config.templates_path.append(str(theme_path / "components")) - return {"parallel_read_safe": True, "parallel_write_safe": True} + return {"parallel_read_safe": True, "parallel_write_safe": False} diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html index c9e97c080..0fd806e15 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html @@ -79,8 +79,8 @@
{# Primary sidebar #} - {# If we have no sidebar TOC, pop the TOC component from the sidebar list #} - {% if missing_sidebar_toctree(includehidden=theme_sidebar_includehidden) %} + {# If we have no sidebar TOC, pop the TOC component from the sidebars list #} + {% if suppress_sidebar_toctree(includehidden=theme_sidebar_includehidden | tobool) %} {% set sidebars = sidebars | reject("in", "sidebar-nav-bs.html") | list %} {% endif %}