Merge pull request #4792 from jfbu/autosummary_latex_tablespec

Fix autosummary latex table colspec (closes #4790)
This commit is contained in:
Jean-François B 2018-03-28 22:40:32 +02:00 committed by GitHub
commit 3259ba9422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -358,7 +358,7 @@ class Autosummary(Directive):
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = r'p{0.5\linewidth}p{0.5\linewidth}'
table_spec['spec'] = r'\X{1}{2}\X{1}{2}'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])

View File

@ -188,6 +188,16 @@ def test_autosummary_generate(app, status, warning):
' \n' in Foo)
@pytest.mark.sphinx('latex', **default_kw)
def test_autosummary_latex_table_colspec(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'Python.tex').text(encoding='utf8')
print(status.getvalue())
print(warning.getvalue())
assert r'\begin{longtable}{\X{1}{2}\X{1}{2}}' in result
assert r'p{0.5\linewidth}' not in result
def test_import_by_name():
import sphinx
import sphinx.ext.autosummary