From 8e23b03263ce731a70bd3ddee99eead73a47663d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 11 Dec 2021 23:05:33 +0900 Subject: [PATCH] refactor: texinfo: Remove CR char from output The CR character was added for readability of output. But it makes the texinfo writer a bit complicated. This removes it from output to keep our code simple (reducing conditions). --- sphinx/writers/texinfo.py | 6 ++---- tests/test_build_texinfo.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 44842f7541e..9a281dc9a99 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -765,12 +765,10 @@ def visit_title_reference(self, node: Element) -> None: # -- Blocks def visit_paragraph(self, node: Element) -> None: - if not self.in_footnote: - self.body.append('\n') + self.body.append('\n') def depart_paragraph(self, node: Element) -> None: - if not self.in_footnote: - self.body.append('\n') + self.body.append('\n') def visit_block_quote(self, node: Element) -> None: self.body.append('\n@quotation\n') diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py index 249587ccf17..bece3a558d4 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_build_texinfo.py @@ -119,7 +119,7 @@ def test_texinfo_footnote(app, status, warning): app.builder.build_all() output = (app.outdir / 'python.texi').read_text() - assert 'First footnote: @footnote{First}' in output + assert 'First footnote: @footnote{\nFirst\n}' in output @pytest.mark.sphinx('texinfo')