Skip to content

Commit

Permalink
refactor: texinfo: Remove CR char from output
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tk0miya committed Dec 11, 2021
1 parent 5563f67 commit 8e23b03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions sphinx/writers/texinfo.py
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build_texinfo.py
Expand Up @@ -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')
Expand Down

0 comments on commit 8e23b03

Please sign in to comment.