From b14f9d7482f250ac86da9934647845912f38db5c Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Wed, 8 Apr 2020 22:32:54 +0200 Subject: [PATCH 1/3] Add globaltoc_collapse and globaltoc_includehidden options --- sphinx/themes/basic/globaltoc.html | 2 +- sphinx/themes/basic/theme.conf | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinx/themes/basic/globaltoc.html b/sphinx/themes/basic/globaltoc.html index 59cab989b..2f16655cf 100644 --- a/sphinx/themes/basic/globaltoc.html +++ b/sphinx/themes/basic/globaltoc.html @@ -8,4 +8,4 @@ :license: BSD, see LICENSE for details. #}

{{ _('Table of Contents') }}

-{{ toctree() }} +{{ toctree(includehidden=theme_globaltoc_includehidden, collapse=theme_globaltoc_collapse) }} diff --git a/sphinx/themes/basic/theme.conf b/sphinx/themes/basic/theme.conf index df02a5aec..3c289d5dc 100644 --- a/sphinx/themes/basic/theme.conf +++ b/sphinx/themes/basic/theme.conf @@ -10,3 +10,5 @@ sidebarwidth = 230 body_min_width = 450 body_max_width = 800 navigation_with_keys = False +globaltoc_collapse = true +globaltoc_includehidden = false From c17f00c7a26975d09f1c3d3617b36e99aa0a2aeb Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Mon, 13 Apr 2020 19:22:17 +0200 Subject: [PATCH 2/3] DOC: globaltoc_collapse, globaltoc_includehidden --- doc/usage/theming.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index 5ed9f1f1b..e9d57abbb 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -155,6 +155,21 @@ These themes are: previous/next page using the keyboard's left and right arrows. Defaults to ``False``. + .. versionadded:: 3.1 + + The following options: + + - **globaltoc_collapse** (true or false): Only expand subsections + of the current document in ``globaltoc.html`` + (see :confval:`html_sidebars`). + Defaults to ``True``. + + - **globaltoc_includehidden** (true or false): Show even those + subsections in ``globaltoc.html`` (see :confval:`html_sidebars`) + which have been included with the ``:hidden:`` flag of the + :rst:dir:`toctree` directive. + Defaults to ``False``. + **alabaster** `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz (especially as used in his Requests project), which was itself originally From 3baa6e09e2c488a29c2d6d18172aa47422dc4f1c Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Wed, 15 Apr 2020 21:02:41 +0200 Subject: [PATCH 3/3] FIXUP: move "versionadded" --- doc/usage/theming.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index e9d57abbb..0aae78718 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -155,21 +155,21 @@ These themes are: previous/next page using the keyboard's left and right arrows. Defaults to ``False``. - .. versionadded:: 3.1 - - The following options: - - **globaltoc_collapse** (true or false): Only expand subsections of the current document in ``globaltoc.html`` (see :confval:`html_sidebars`). Defaults to ``True``. + .. versionadded:: 3.1 + - **globaltoc_includehidden** (true or false): Show even those subsections in ``globaltoc.html`` (see :confval:`html_sidebars`) which have been included with the ``:hidden:`` flag of the :rst:dir:`toctree` directive. Defaults to ``False``. + .. versionadded:: 3.1 + **alabaster** `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz (especially as used in his Requests project), which was itself originally