summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--sphinx/texinputs/sphinx.sty2
-rw-r--r--sphinx/writers/texinfo.py6
-rw-r--r--tests/roots/test-markup-citation/conf.py7
-rw-r--r--tests/roots/test-markup-citation/index.rst9
-rw-r--r--tests/roots/test-markup-rubric/conf.py7
-rw-r--r--tests/roots/test-markup-rubric/index.rst7
-rw-r--r--tests/test_build_texinfo.py21
-rw-r--r--tox.ini2
9 files changed, 61 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 89a05b7ae..70e9d990d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -98,6 +98,8 @@ 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
+* #3080: texinfo: multiline citations are broken
Testing
--------
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index f16035973..249f2ece0 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -6,7 +6,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{sphinx}[2018/09/18 v1.8.1 LaTeX package (Sphinx markup)]
+\ProvidesPackage{sphinx}[2018/11/06 v1.8.2 LaTeX package (Sphinx markup)]
% provides \ltx@ifundefined
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py
index 91e534278..65d513d08 100644
--- a/sphinx/writers/texinfo.py
+++ b/sphinx/writers/texinfo.py
@@ -671,9 +671,11 @@ class TexinfoTranslator(nodes.NodeVisitor):
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):
@@ -918,12 +920,14 @@ class TexinfoTranslator(nodes.NodeVisitor):
def visit_citation(self, node):
# type: (nodes.Node) -> None
+ self.body.append('\n')
for id in node.get('ids'):
self.add_anchor(id, node)
+ self.escape_newlines += 1
def depart_citation(self, node):
# type: (nodes.Node) -> None
- pass
+ self.escape_newlines -= 1
def visit_citation_reference(self, node):
# type: (nodes.Node) -> None
diff --git a/tests/roots/test-markup-citation/conf.py b/tests/roots/test-markup-citation/conf.py
new file mode 100644
index 000000000..31e7a6ed4
--- /dev/null
+++ b/tests/roots/test-markup-citation/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')
+]
diff --git a/tests/roots/test-markup-citation/index.rst b/tests/roots/test-markup-citation/index.rst
new file mode 100644
index 000000000..238f0932b
--- /dev/null
+++ b/tests/roots/test-markup-citation/index.rst
@@ -0,0 +1,9 @@
+test-markup-citation
+=====================
+
+This is a citation ref; [CITE1]_ and [CITE2]_.
+
+.. [CITE1] This is a citation
+
+.. [CITE2] This is
+ a multiline citation
diff --git a/tests/roots/test-markup-rubric/conf.py b/tests/roots/test-markup-rubric/conf.py
new file mode 100644
index 000000000..31e7a6ed4
--- /dev/null
+++ b/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')
+]
diff --git a/tests/roots/test-markup-rubric/index.rst b/tests/roots/test-markup-rubric/index.rst
new file mode 100644
index 000000000..c2ae68a86
--- /dev/null
+++ b/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
diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py
index c14daf6ee..1ec4f83dc 100644
--- a/tests/test_build_texinfo.py
+++ b/tests/test_build_texinfo.py
@@ -68,3 +68,24 @@ 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
+
+
+@pytest.mark.sphinx('texinfo', testroot='markup-citation')
+def test_texinfo_citation(app, status, warning):
+ app.builder.build_all()
+
+ output = (app.outdir / 'python.texi').text()
+ assert 'This is a citation ref; @ref{1,,[CITE1]} and @ref{2,,[CITE2]}.' in output
+ assert ('@anchor{index cite1}@anchor{1}@w{(CITE1)} \n'
+ 'This is a citation\n') in output
+ assert ('@anchor{index cite2}@anchor{2}@w{(CITE2)} \n'
+ 'This is a multiline citation\n') in output
diff --git a/tox.ini b/tox.ini
index 971955ea8..cd64cc431 100644
--- a/tox.ini
+++ b/tox.ini
@@ -19,6 +19,8 @@ deps =
du12: docutils==0.12
du13: docutils==0.13.1
du14: docutils==0.14
+# This entry should be also removed after moving 'extras' option
+install_command = pip install {opts} {packages}
setenv =
PYTHONWARNINGS = all,ignore::ImportWarning:pkgutil,ignore::ImportWarning:importlib._bootstrap,ignore::ImportWarning:importlib._bootstrap_external,ignore::ImportWarning:pytest_cov.plugin,ignore::DeprecationWarning:site,ignore::DeprecationWarning:_pytest.assertion.rewrite,ignore::DeprecationWarning:_pytest.fixtures,ignore::DeprecationWarning:distutils
SPHINX_TEST_TEMPDIR = {envdir}/testbuild