Fix #3479: add latex support for docutils table stub columns

This implementation in latex writer allows arbitrary columns to be
declared "stub columns". But currently Docutils option
``:stub-columns:`` only allows a number telling the how many initial
columns are "stub columns".
This commit is contained in:
jfbu
2017-04-30 18:38:43 +02:00
parent 1385e1ac1b
commit 75653d85ac
4 changed files with 55 additions and 1 deletions

View File

@@ -130,3 +130,22 @@ longtable having problematic cell
- cell2-2
* - cell3-1
- cell3-2
longtable having both stub columns and problematic cell
-------------------------------------------------------
.. list-table::
:class: longtable
:header-rows: 1
:stub-columns: 2
* - header1
- header2
- header3
* - + instub1-1a
+ instub1-1b
- instub1-2
- notinstub1-3
* - cell2-1
- cell2-2
- cell2-3

View File

@@ -133,3 +133,21 @@ table having problematic cell
- cell2-2
* - cell3-1
- cell3-2
table having both stub columns and problematic cell
---------------------------------------------------
.. list-table::
:header-rows: 1
:stub-columns: 2
* - header1
- header2
- header3
* - + instub1-1a
+ instub1-1b
- instub1-2
- notinstub1-3
* - cell2-1
- cell2-2
- cell2-3

View File

@@ -916,6 +916,13 @@ def test_latex_table_tabulars(app, status, warning):
table = tables['table having both :widths: and problematic cell']
assert ('\\begin{tabular}[t]{|\\X{30}{100}|\\X{70}{100}|}' in table)
# table having both stub columns and problematic cell
table = tables['table having both stub columns and problematic cell']
assert ('&\\sphinxstylethead{\\sphinxstyletheadfamily \n'
'instub1-2\n\\unskip}\\relax &\nnotinstub1-3\n\\\\\n'
'\\hline\\sphinxstylethead{\\sphinxstyletheadfamily \n'
'cell2-1\n\\unskip}\\relax &' in table)
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
reason='docutils-0.13 or above is required')
@@ -982,6 +989,13 @@ def test_latex_table_longtable(app, status, warning):
table = tables['longtable having both :widths: and problematic cell']
assert ('\\begin{longtable}{|\\X{30}{100}|\\X{70}{100}|}' in table)
# longtable having both stub columns and problematic cell
table = tables['longtable having both stub columns and problematic cell']
assert ('&\\sphinxstylethead{\\sphinxstyletheadfamily \n'
'instub1-2\n\\unskip}\\relax &\nnotinstub1-3\n\\\\\n'
'\\hline\\sphinxstylethead{\\sphinxstyletheadfamily \n'
'cell2-1\n\\unskip}\\relax &' in table)
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
reason='docutils-0.13 or above is required')