From 3c0107d0511f411cdfe34d92eb0bb43bb466493f Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 28 Aug 2024 19:15:55 -0700 Subject: [PATCH 1/4] local toc with immediate parents, less in the global toc --- Doc/conf.py | 2 +- Doc/contents.rst | 1 + Doc/tools/templates/customlocaltoc.html | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Doc/tools/templates/customlocaltoc.html diff --git a/Doc/conf.py b/Doc/conf.py index c1b07df08b1782..b61a8364f7c397 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -314,7 +314,7 @@ html_sidebars = { # Defaults taken from https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_sidebars # Removes the quick search block - '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'], + '**': ['customlocaltoc.html', 'relations.html', 'customsourcelink.html'], 'index': ['indexsidebar.html'], } diff --git a/Doc/contents.rst b/Doc/contents.rst index b57f4b09a5dcb6..95c0083c611f26 100644 --- a/Doc/contents.rst +++ b/Doc/contents.rst @@ -3,6 +3,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% .. toctree:: + :maxdepth: 2 whatsnew/index.rst tutorial/index.rst diff --git a/Doc/tools/templates/customlocaltoc.html b/Doc/tools/templates/customlocaltoc.html new file mode 100644 index 00000000000000..874617acb78845 --- /dev/null +++ b/Doc/tools/templates/customlocaltoc.html @@ -0,0 +1,24 @@ +{# + Customization of sphinx's basic/localtoc.html + + - Always display links to the parent pages within sections, + rather than link to the global contents + - +#} +
+
+{%- if parents %} +{%- for parent in parents %} + + + {{ parent.title }} + + +{%- endfor %} +{%- else %} +

{{ docstitle|e }}

+{%- endif %} +
+ {{ toc }} +
\ No newline at end of file From a4c47bab7697c520099b71b2d7d4dbc05d549e90 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 28 Aug 2024 19:42:47 -0700 Subject: [PATCH 2/4] cleanup template comment --- Doc/tools/templates/customlocaltoc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tools/templates/customlocaltoc.html b/Doc/tools/templates/customlocaltoc.html index 874617acb78845..e6d9e343242aed 100644 --- a/Doc/tools/templates/customlocaltoc.html +++ b/Doc/tools/templates/customlocaltoc.html @@ -1,9 +1,9 @@ {# Customization of sphinx's basic/localtoc.html - - Always display links to the parent pages within sections, + - When present, display links to the parent pages within sections, rather than link to the global contents - - + - When parents are absent, display a link to the document root using the docstitle #}
From c214910698be99acde5fb6cfac2acc79f87b286b Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 28 Aug 2024 19:47:47 -0700 Subject: [PATCH 3/4] tabs to spaces --- Doc/tools/templates/customlocaltoc.html | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Doc/tools/templates/customlocaltoc.html b/Doc/tools/templates/customlocaltoc.html index e6d9e343242aed..c31ddf176663bd 100644 --- a/Doc/tools/templates/customlocaltoc.html +++ b/Doc/tools/templates/customlocaltoc.html @@ -1,24 +1,24 @@ {# - Customization of sphinx's basic/localtoc.html + Customization of sphinx's basic/localtoc.html - - When present, display links to the parent pages within sections, - rather than link to the global contents - - When parents are absent, display a link to the document root using the docstitle + - When present, display links to the parent pages within sections, + rather than link to the global contents + - When parents are absent, display a link to the document root using the docstitle #} -
-
+
+
{%- if parents %} {%- for parent in parents %} - - - {{ parent.title }} - - + + + {{ parent.title }} + + {%- endfor %} {%- else %} -

{{ docstitle|e }}

+

{{ docstitle|e }}

{%- endif %} -
- {{ toc }} -
\ No newline at end of file +
+ {{ toc }} +
\ No newline at end of file From 38baf4ac4bfca71e81feed3b40060effd37a9a85 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Thu, 29 Aug 2024 00:00:34 -0700 Subject: [PATCH 4/4] add title to global toc entry, make formatting match --- Doc/tools/templates/customlocaltoc.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/tools/templates/customlocaltoc.html b/Doc/tools/templates/customlocaltoc.html index c31ddf176663bd..e93c185019801c 100644 --- a/Doc/tools/templates/customlocaltoc.html +++ b/Doc/tools/templates/customlocaltoc.html @@ -17,7 +17,12 @@ {%- endfor %} {%- else %} -

{{ docstitle|e }}

+

+ + {{ docstitle|e }} + +

{%- endif %}
{{ toc }}