mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
parent
2398bc9f77
commit
9aca29a781
@ -1477,8 +1477,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
context = ('\\par\n\\vskip-\\baselineskip'
|
context = ('\\par\n\\vskip-\\baselineskip'
|
||||||
'\\vbox{\\hbox{\\strut}}\\end{varwidth}%\n') + context
|
'\\vbox{\\hbox{\\strut}}\\end{varwidth}%\n') + context
|
||||||
self.needs_linetrimming = 1
|
self.needs_linetrimming = 1
|
||||||
if len(node) > 2 and len(node.astext().split('\n')) > 2:
|
|
||||||
self.needs_linetrimming = 1
|
|
||||||
if len(node.traverse(nodes.paragraph)) >= 2:
|
if len(node.traverse(nodes.paragraph)) >= 2:
|
||||||
self.table.has_oldproblematic = True
|
self.table.has_oldproblematic = True
|
||||||
if isinstance(node.parent.parent, nodes.thead) or (cell.col in self.table.stubs):
|
if isinstance(node.parent.parent, nodes.thead) or (cell.col in self.table.stubs):
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
\label{\detokenize{tabular:table-with-cell-in-first-column-having-three-paragraphs}}
|
||||||
|
|
||||||
|
\begin{savenotes}\sphinxattablestart
|
||||||
|
\centering
|
||||||
|
\begin{tabulary}{\linewidth}[t]{|T|}
|
||||||
|
\hline
|
||||||
|
\sphinxstylethead{\sphinxstyletheadfamily
|
||||||
|
header1
|
||||||
|
\unskip}\relax \\
|
||||||
|
\hline
|
||||||
|
cell1-1-par1
|
||||||
|
|
||||||
|
cell1-1-par2
|
||||||
|
|
||||||
|
cell1-1-par3
|
||||||
|
\\
|
||||||
|
\hline
|
||||||
|
\end{tabulary}
|
||||||
|
\par
|
||||||
|
\sphinxattableend\end{savenotes}
|
@ -68,6 +68,20 @@ cell2-1 cell2-2
|
|||||||
cell3-1 cell3-2
|
cell3-1 cell3-2
|
||||||
======= =======
|
======= =======
|
||||||
|
|
||||||
|
table with cell in first column having three paragraphs
|
||||||
|
-------------------------------------------------------
|
||||||
|
|
||||||
|
+--------------+
|
||||||
|
| header1 |
|
||||||
|
+==============+
|
||||||
|
| cell1-1-par1 |
|
||||||
|
| |
|
||||||
|
| cell1-1-par2 |
|
||||||
|
| |
|
||||||
|
| cell1-1-par3 |
|
||||||
|
+--------------+
|
||||||
|
|
||||||
|
|
||||||
table having caption
|
table having caption
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -877,7 +877,7 @@ def test_maxlistdepth_at_ten(app, status, warning):
|
|||||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||||
reason='docutils-0.13 or above is required')
|
reason='docutils-0.13 or above is required')
|
||||||
@pytest.mark.sphinx('latex', testroot='latex-table')
|
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||||
@pytest.mark.test_params(shared_result='test_latex_table')
|
@pytest.mark.test_params(shared_result='latex-table')
|
||||||
def test_latex_table_tabulars(app, status, warning):
|
def test_latex_table_tabulars(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
@ -914,6 +914,11 @@ def test_latex_table_tabulars(app, status, warning):
|
|||||||
expected = get_expected('tabularcolumn')
|
expected = get_expected('tabularcolumn')
|
||||||
assert actual == expected
|
assert actual == expected
|
||||||
|
|
||||||
|
# table with cell in first column having three paragraphs
|
||||||
|
actual = tables['table with cell in first column having three paragraphs']
|
||||||
|
expected = get_expected('table_having_threeparagraphs_cell_in_first_col')
|
||||||
|
assert actual == expected
|
||||||
|
|
||||||
# table having caption
|
# table having caption
|
||||||
actual = tables['table having caption']
|
actual = tables['table having caption']
|
||||||
expected = get_expected('table_having_caption')
|
expected = get_expected('table_having_caption')
|
||||||
@ -943,7 +948,7 @@ def test_latex_table_tabulars(app, status, warning):
|
|||||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||||
reason='docutils-0.13 or above is required')
|
reason='docutils-0.13 or above is required')
|
||||||
@pytest.mark.sphinx('latex', testroot='latex-table')
|
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||||
@pytest.mark.test_params(shared_result='test_latex_table')
|
@pytest.mark.test_params(shared_result='latex-table')
|
||||||
def test_latex_table_longtable(app, status, warning):
|
def test_latex_table_longtable(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
@ -1004,7 +1009,7 @@ def test_latex_table_longtable(app, status, warning):
|
|||||||
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
|
||||||
reason='docutils-0.13 or above is required')
|
reason='docutils-0.13 or above is required')
|
||||||
@pytest.mark.sphinx('latex', testroot='latex-table')
|
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||||
@pytest.mark.test_params(shared_result='test_latex_table')
|
@pytest.mark.test_params(shared_result='latex-table')
|
||||||
def test_latex_table_complex_tables(app, status, warning):
|
def test_latex_table_complex_tables(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
|
Loading…
Reference in New Issue
Block a user