docs: no third level toc on command usage pages ("Description", "Examples")

This commit is contained in:
Marian Beermann 2017-06-30 17:41:58 +02:00
parent 193c1850e4
commit f6c3d1d2cc
2 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,16 @@
<div class="sidebar-block">
<div class="sidebar-toc">
{% set toctree = toctree(maxdepth=3, collapse=True, includehidden=True) %}
{# Restrict the sidebar toc depth to two levels while generating command usage pages.
This avoids superfluous entries for each "Description" and "Examples" heading. #}
{% if pagename.startswith("usage/") and pagename not in (
"usage/general", "usage/help", "usage/debug", "usage/notes",
) %}
{% set maxdepth = 2 %}
{% else %}
{% set maxdepth = 3 %}
{% endif %}
{% set toctree = toctree(maxdepth=maxdepth, collapse=True) %}
{% if toctree %}
{{ toctree }}
{% else %}

View File

@ -31,8 +31,6 @@ Usage
</script>
.. toctree::
:hidden:
usage/general
usage/init