diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index 1bfbad514..92f2ba938 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -330,8 +330,7 @@ class EpubBuilder(StandaloneHTMLBuilder): fn = fns[-1] return fn.parent, fn.parent.index(fn) + 1 for node in tree.traverse(nodes.rubric): - if len(node.children) == 1 and \ - node.children[0].astext() == FOOTNOTES_RUBRIC_NAME: + if len(node) == 1 and node.astext() == FOOTNOTES_RUBRIC_NAME: return node.parent, node.parent.index(node) + 1 doc = tree.traverse(nodes.document)[0] rub = nodes.rubric() diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index f0ce485d7..ea293ef5c 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1230,8 +1230,7 @@ class LaTeXTranslator(SphinxTranslator): def visit_rubric(self, node): # type: (nodes.rubric) -> None - if len(node.children) == 1 and node.children[0].astext() in \ - ('Footnotes', _('Footnotes')): + if len(node) == 1 and node.astext() in ('Footnotes', _('Footnotes')): raise nodes.SkipNode self.body.append('\\subsubsection*{') self.context.append('}\n') diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index 179c8ef9f..ececac185 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -268,12 +268,9 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator): def visit_rubric(self, node): # type: (nodes.rubric) -> None self.ensure_eol() - if len(node.children) == 1: - rubtitle = node.children[0].astext() - if rubtitle in ('Footnotes', _('Footnotes')): - self.body.append('.SH ' + self.deunicode(rubtitle).upper() + - '\n') - raise nodes.SkipNode + if len(node) == 1 and node.astext() in ('Footnotes', _('Footnotes')): + self.body.append('.SH ' + self.deunicode(node.astext()).upper() + '\n') + raise nodes.SkipNode else: self.body.append('.sp\n') diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index c15050574..877380d38 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -669,8 +669,7 @@ class TexinfoTranslator(SphinxTranslator): def visit_rubric(self, node): # type: (nodes.rubric) -> None - if len(node.children) == 1 and node.children[0].astext() in \ - ('Footnotes', _('Footnotes')): + if len(node) == 1 and node.astext() in ('Footnotes', _('Footnotes')): raise nodes.SkipNode try: rubric = self.rubrics[self.section_level] diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index fdf59b9a5..c1506e4db 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -146,6 +146,8 @@ def test_writer(app, status, warning): '\\label{\\detokenize{markup:id11}}' '\\end{wrapfigure}' in result) + assert 'Footnotes' not in result + @pytest.mark.sphinx('latex', testroot='warnings', freshenv=True) def test_latex_warnings(app, status, warning): diff --git a/tests/test_build_manpage.py b/tests/test_build_manpage.py index 405f10832..8a3777a30 100644 --- a/tests/test_build_manpage.py +++ b/tests/test_build_manpage.py @@ -29,6 +29,8 @@ def test_all(app, status, warning): assert '\n.B term1\n' in content assert '\nterm2 (\\fBstronged partially\\fP)\n' in content + assert 'Footnotes' not in content + def test_default_man_pages(): config = Config({'master_doc': 'index', diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py index 4230d36ac..63b9a69ba 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_build_texinfo.py @@ -52,6 +52,7 @@ def test_texinfo(app, status, warning): assert ('@anchor{markup doc}@anchor{11}' '@anchor{markup id1}@anchor{12}' '@anchor{markup testing-various-markup}@anchor{13}' in result) + assert 'Footnotes' not in result # now, try to run makeinfo over it cwd = os.getcwd() os.chdir(app.outdir)