mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix changes in #3381 is lost on merging
This commit is contained in:
parent
35ce2ea432
commit
fdd6f90792
@ -339,7 +339,9 @@ class Table(object):
|
|||||||
return 'longtable'
|
return 'longtable'
|
||||||
elif self.has_verbatim:
|
elif self.has_verbatim:
|
||||||
return 'tabular'
|
return 'tabular'
|
||||||
elif self.has_problematic and not self.colspec:
|
elif self.colspec:
|
||||||
|
return 'tabulary'
|
||||||
|
elif self.has_problematic or (self.colwidths and 'colwidths-given' in self.classes):
|
||||||
return 'tabular'
|
return 'tabular'
|
||||||
else:
|
else:
|
||||||
return 'tabulary'
|
return 'tabulary'
|
||||||
|
@ -26,6 +26,19 @@ table having :widths: option
|
|||||||
cell3-1 cell3-2
|
cell3-1 cell3-2
|
||||||
======= =======
|
======= =======
|
||||||
|
|
||||||
|
table with tabularcolumn
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. tabularcolumns:: |c|c|
|
||||||
|
|
||||||
|
======= =======
|
||||||
|
header1 header2
|
||||||
|
======= =======
|
||||||
|
cell1-1 cell1-2
|
||||||
|
cell2-1 cell2-2
|
||||||
|
cell3-1 cell3-2
|
||||||
|
======= =======
|
||||||
|
|
||||||
table having caption
|
table having caption
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
@ -121,6 +134,22 @@ longtable having :widths: option
|
|||||||
cell3-1 cell3-2
|
cell3-1 cell3-2
|
||||||
======= =======
|
======= =======
|
||||||
|
|
||||||
|
longtable with tabularcolumn
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
.. tabularcolumns:: |c|c|
|
||||||
|
|
||||||
|
.. table::
|
||||||
|
:class: longtable
|
||||||
|
|
||||||
|
======= =======
|
||||||
|
header1 header2
|
||||||
|
======= =======
|
||||||
|
cell1-1 cell1-2
|
||||||
|
cell2-1 cell2-2
|
||||||
|
cell3-1 cell3-2
|
||||||
|
======= =======
|
||||||
|
|
||||||
longtable having caption
|
longtable having caption
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
@ -841,15 +841,18 @@ def test_latex_table(app, status, warning):
|
|||||||
|
|
||||||
# table having :widths: option
|
# table having :widths: option
|
||||||
table = tables['table having :widths: option']
|
table = tables['table having :widths: option']
|
||||||
assert ('\\noindent\\begin{tabulary}{\\linewidth}'
|
assert ('\\noindent\\begin{tabular}{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
||||||
'{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
|
||||||
assert ('\\hline\n'
|
assert ('\\hline\n'
|
||||||
'\\sphinxstylethead{\\relax \nheader1\n\\unskip}\\relax &'
|
'\\sphinxstylethead{\\relax \nheader1\n\\unskip}\\relax &'
|
||||||
'\\sphinxstylethead{\\relax \nheader2\n\\unskip}\\relax' in table)
|
'\\sphinxstylethead{\\relax \nheader2\n\\unskip}\\relax' in table)
|
||||||
assert ('\\hline\ncell1-1\n&\ncell1-2\n\\\\' in table)
|
assert ('\\hline\ncell1-1\n&\ncell1-2\n\\\\' in table)
|
||||||
assert ('\\hline\ncell2-1\n&\ncell2-2\n\\\\' in table)
|
assert ('\\hline\ncell2-1\n&\ncell2-2\n\\\\' in table)
|
||||||
assert ('\\hline\ncell3-1\n&\ncell3-2\n\\\\' in table)
|
assert ('\\hline\ncell3-1\n&\ncell3-2\n\\\\' in table)
|
||||||
assert ('\\hline\\end{tabulary}' in table)
|
assert ('\\hline\\end{tabular}' in table)
|
||||||
|
|
||||||
|
# table with tabularcolumn
|
||||||
|
table = tables['table with tabularcolumn']
|
||||||
|
assert ('\\noindent\\begin{tabulary}{\\linewidth}{|c|c|}' in table)
|
||||||
|
|
||||||
# table having caption
|
# table having caption
|
||||||
table = tables['table having caption']
|
table = tables['table having caption']
|
||||||
@ -902,6 +905,10 @@ def test_latex_table(app, status, warning):
|
|||||||
table = tables['longtable having :widths: option']
|
table = tables['longtable having :widths: option']
|
||||||
assert ('\\begin{longtable}{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
assert ('\\begin{longtable}{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
||||||
|
|
||||||
|
# longtable with tabularcolumn
|
||||||
|
table = tables['longtable with tabularcolumn']
|
||||||
|
assert ('\\begin{longtable}{|c|c|}' in table)
|
||||||
|
|
||||||
# longtable having caption
|
# longtable having caption
|
||||||
table = tables['longtable having caption']
|
table = tables['longtable having caption']
|
||||||
assert ('\\begin{longtable}{|l|l|}\n\\caption{caption for longtable}'
|
assert ('\\begin{longtable}{|l|l|}\n\\caption{caption for longtable}'
|
||||||
|
Loading…
Reference in New Issue
Block a user