summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksaC <aleksacukovic1@gmail.com>2020-07-11 12:32:37 +0200
committerAleksaC <aleksacukovic1@gmail.com>2020-07-11 12:32:37 +0200
commit73bbe90ee044ad3c0da8d1f63a1377531bdb4972 (patch)
treedabf4c08ebba230f087de4660c28076f287eb533
parent72abb19740584bb273a38e4f3ed311b19327f87a (diff)
downloadsphinx-git-73bbe90ee044ad3c0da8d1f63a1377531bdb4972.tar.gz
Cleaner fix for double trailing whitespace apidoc
-rw-r--r--sphinx/templates/apidoc/package.rst_t7
-rw-r--r--tests/test_ext_apidoc.py1
2 files changed, 3 insertions, 5 deletions
diff --git a/sphinx/templates/apidoc/package.rst_t b/sphinx/templates/apidoc/package.rst_t
index e599d71e4..b7380e8a0 100644
--- a/sphinx/templates/apidoc/package.rst_t
+++ b/sphinx/templates/apidoc/package.rst_t
@@ -35,16 +35,15 @@ Submodules
----------
{% if separatemodules %}
{{ toctree(submodules) }}
-{% endif %}
-{%- if not separatemodules %}
+{% else %}
{%- for submodule in submodules %}
{% if show_headings %}
{{- [submodule, "module"] | join(" ") | e | heading(2) }}
{% endif %}
{{ automodule(submodule, automodule_options) }}
{% endfor %}
-{%- endif -%}
-{% endif %}
+{%- endif %}
+{%- endif %}
{%- if not modulefirst and not is_namespace %}
Module contents
diff --git a/tests/test_ext_apidoc.py b/tests/test_ext_apidoc.py
index 550a2acc8..e19a1d7ba 100644
--- a/tests/test_ext_apidoc.py
+++ b/tests/test_ext_apidoc.py
@@ -121,7 +121,6 @@ def test_pep_0420_enabled_separate(make_app, apidoc):
with open(outdir / 'a.b.c.rst') as f:
rst = f.read()
-
assert ".. toctree::\n :maxdepth: 4\n\n a.b.c.d\n" in rst
with open(outdir / 'a.b.e.rst') as f: