Skip to content

Commit

Permalink
Fix sphinx-doc#3080: texinfo: multiline rubric is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Nov 8, 2018
1 parent 63daf8c commit 84f7812
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -38,6 +38,7 @@ Bugs fixed
crashed
* #5561: make all-pdf fails with old xindy version
* #5557: quickstart: --no-batchfile isn't honored
* #3080: texinfo: multiline rubrics are broken

Testing
--------
Expand Down
2 changes: 2 additions & 0 deletions sphinx/writers/texinfo.py
Expand Up @@ -673,9 +673,11 @@ def visit_rubric(self, node):
except IndexError:
rubric = self.rubrics[-1]
self.body.append('\n%s ' % rubric)
self.escape_newlines += 1

def depart_rubric(self, node):
# type: (nodes.Node) -> None
self.escape_newlines -= 1
self.body.append('\n\n')

def visit_subtitle(self, node):
Expand Down
7 changes: 7 additions & 0 deletions tests/roots/test-markup-rubric/conf.py
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-

master_doc = 'index'

latex_documents = [
(master_doc, 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report')
]
7 changes: 7 additions & 0 deletions tests/roots/test-markup-rubric/index.rst
@@ -0,0 +1,7 @@
test-markup-rubric
===================

.. rubric:: This is a rubric

.. rubric:: This is
a multiline rubric
9 changes: 9 additions & 0 deletions tests/test_build_texinfo.py
Expand Up @@ -72,3 +72,12 @@ def test_texinfo(app, status, warning):
assert False, 'makeinfo exited with return code %s' % retcode
finally:
os.chdir(cwd)


@pytest.mark.sphinx('texinfo', testroot='markup-rubric')
def test_texinfo_rubric(app, status, warning):
app.build()

output = (app.outdir / 'python.texi').text()
assert '@heading This is a rubric' in output
assert '@heading This is a multiline rubric' in output

0 comments on commit 84f7812

Please sign in to comment.