From dc1c5fee702ec4537d31823cc87fc3bb13e00767 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 6 May 2019 21:27:43 +0900 Subject: [PATCH] Fix #6331: man: invalid output when doctest follows rubric --- CHANGES | 1 + sphinx/writers/manpage.py | 2 +- tests/test_build_manpage.py | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e9ba00d96..57c18836d 100644 --- a/CHANGES +++ b/CHANGES @@ -94,6 +94,7 @@ Bugs fixed * #6213: ifconfig: contents after headings are not shown * commented term in glossary directive is wrongly recognized * #6299: rst domain: rst:directive directive generates waste space +* #6331: man: invalid output when doctest follows rubric Testing -------- diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index 0856ee5ee..7811ccc5b 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -282,7 +282,7 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator): def depart_rubric(self, node): # type: (nodes.Element) -> None - pass + self.body.append('\n') def visit_seealso(self, node): # type: (nodes.Element) -> None diff --git a/tests/test_build_manpage.py b/tests/test_build_manpage.py index 17a2f7eb8..a0a3efb00 100644 --- a/tests/test_build_manpage.py +++ b/tests/test_build_manpage.py @@ -59,3 +59,10 @@ def test_default_man_pages(): expected = [('index', 'stasi', 'STASI™ Documentation 1.0', ["Wolfgang Schäuble & G'Beckstein"], 1)] assert default_man_pages(config) == expected + + +@pytest.mark.sphinx('man', testroot='markup-rubric') +def test_rubric(app, status, warning): + app.build() + content = (app.outdir / 'python.1').text() + assert 'This is a rubric\n' in content