Skip to content

Commit

Permalink
Test and changelog entry for PR #422
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtm committed Dec 14, 2023
1 parent 3c87c45 commit 26635ef
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Changed:

Fixed:

* Rendering of tables with no body (#420, PR #422 by th0mr)
* Hyphenation of the first word on a line (#188, #416)
* AttributeError: 'ZeroWidthSpace' object has no attribute 'hyphenate' (#415,
PR #417 by Jack Whitham)
Expand Down
6 changes: 1 addition & 5 deletions src/rinoh/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,7 @@ def _size_columns(self, container):
- cell contents
"""
if self.body is not None:
num_cols = self.body.num_columns
else:
# Table is a head-only table
num_cols = self.head.num_columns
num_cols = (self.body or self.head).num_columns
width = self._width(container)
if width == FlowableWidth.FILL:
width = 100 * PERCENT
Expand Down
Empty file.
Binary file added tests_regression/rst/table_no_body.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions tests_regression/rst/table_no_body.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

.. csv-table:: Table with header but without body
:header: "What", "A", "Fun", "Issue"
:file: ./table_no_body.csv


.. csv-table:: Table without header nor body
:file: ./table_no_body.csv
127 changes: 127 additions & 0 deletions tests_regression/rst/table_no_body.stylelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---------------------------------- page 1 ----------------------------------
#### FlowablesContainer('background')
StaticGroupedFlowables()
#### FootnoteContainer('footnotes')
StaticGroupedFlowables()
#### DownExpandingContainer('floats')
StaticGroupedFlowables()
#### ChainedContainer('column1')
StaticGroupedFlowables()
DocumentTree() table_no_body.rst <document>
TableWithCaption() table_no_body.rst <table>
x (0,0,0,0,2) table with caption
Caption('Table 1. Table with header but w...')
> (0,0,0,0,4) table caption [Sphinx] > caption
SingleStyledText('Table')
SingleStyledText(' ')
MixedStyledText('1. ', style='label')
SingleStyledText('')
SingleStyledText('1')
SingleStyledText('. ')
MixedStyledText('Table with header but without bo...')
MixedStyledText('Table with header but without bo...')
SingleStyledText('Table with header but without bo...')
Table()
> (0,0,0,0,2) table [Sphinx] > DEFAULT
TableHead()
TableRow()
TableCellBackground()
x (0,0,0,0,10) table head cell background
TableCellBorder('top')
> (0,0,0,2,8) table top border [Sphinx] > DEFAULT
(0,0,0,1,2) table cell top border [Sphinx] > table cell border
TableCellBorder('right')
x (0,0,0,1,8) table head cell right border
> (0,0,0,1,2) table cell right border [Sphinx] > table cell border
TableCellBorder('bottom')
> (0,0,0,2,8) table head bottom border [Sphinx] > table top border
(0,0,0,1,2) table cell bottom border [Sphinx] > table cell border
TableCellBorder('left')
x (0,0,0,2,8) table head left border
x (0,0,0,2,4) table left border
x (0,0,0,1,8) table head cell left border
> (0,0,0,1,2) table cell left border [Sphinx] > table cell border
TableCell() <entry>
x (0,0,0,0,8) table head cell
> (0,0,0,0,7) table cell [Sphinx] > DEFAULT
Paragraph('What') table_no_body.rst:1 <paragraph>
> (0,0,0,0,10) table head cell paragraph [Sphinx] > table body cell paragraph
(0,0,0,0,9) table body cell paragraph [Sphinx] > default
(0,0,0,0,2) body [Sphinx] > default
MixedStyledText('What')
MixedStyledText('What')
SingleStyledText('What')
TableCellBackground()
x (0,0,0,0,10) table head cell background
TableCellBorder('top')
> (0,0,0,2,8) table top border [Sphinx] > DEFAULT
(0,0,0,1,2) table cell top border [Sphinx] > table cell border
TableCellBorder('right')
x (0,0,0,1,8) table head cell right border
> (0,0,0,1,2) table cell right border [Sphinx] > table cell border
TableCellBorder('bottom')
> (0,0,0,2,8) table head bottom border [Sphinx] > table top border
(0,0,0,1,2) table cell bottom border [Sphinx] > table cell border
TableCellBorder('left')
x (0,0,0,1,8) table head cell left border
> (0,0,0,1,2) table cell left border [Sphinx] > table cell border
TableCell() <entry>
x (0,0,0,0,8) table head cell
> (0,0,0,0,7) table cell [Sphinx] > DEFAULT
Paragraph('A') table_no_body.rst:1 <paragraph>
> (0,0,0,0,10) table head cell paragraph [Sphinx] > table body cell paragraph
(0,0,0,0,9) table body cell paragraph [Sphinx] > default
(0,0,0,0,2) body [Sphinx] > default
MixedStyledText('A')
MixedStyledText('A')
SingleStyledText('A')
TableCellBackground()
x (0,0,0,0,10) table head cell background
TableCellBorder('top')
> (0,0,0,2,8) table top border [Sphinx] > DEFAULT
(0,0,0,1,2) table cell top border [Sphinx] > table cell border
TableCellBorder('right')
x (0,0,0,1,8) table head cell right border
> (0,0,0,1,2) table cell right border [Sphinx] > table cell border
TableCellBorder('bottom')
> (0,0,0,2,8) table head bottom border [Sphinx] > table top border
(0,0,0,1,2) table cell bottom border [Sphinx] > table cell border
TableCellBorder('left')
x (0,0,0,1,8) table head cell left border
> (0,0,0,1,2) table cell left border [Sphinx] > table cell border
TableCell() <entry>
x (0,0,0,0,8) table head cell
> (0,0,0,0,7) table cell [Sphinx] > DEFAULT
Paragraph('Fun') table_no_body.rst:1 <paragraph>
> (0,0,0,0,10) table head cell paragraph [Sphinx] > table body cell paragraph
(0,0,0,0,9) table body cell paragraph [Sphinx] > default
(0,0,0,0,2) body [Sphinx] > default
MixedStyledText('Fun')
MixedStyledText('Fun')
SingleStyledText('Fun')
TableCellBackground()
x (0,0,0,0,10) table head cell background
TableCellBorder('top')
> (0,0,0,2,8) table top border [Sphinx] > DEFAULT
(0,0,0,1,2) table cell top border [Sphinx] > table cell border
TableCellBorder('right')
x (0,0,0,2,8) table head right border
x (0,0,0,2,4) table right border
x (0,0,0,1,8) table head cell right border
> (0,0,0,1,2) table cell right border [Sphinx] > table cell border
TableCellBorder('bottom')
> (0,0,0,2,8) table head bottom border [Sphinx] > table top border
(0,0,0,1,2) table cell bottom border [Sphinx] > table cell border
TableCellBorder('left')
x (0,0,0,1,8) table head cell left border
> (0,0,0,1,2) table cell left border [Sphinx] > table cell border
TableCell() <entry>
x (0,0,0,0,8) table head cell
> (0,0,0,0,7) table cell [Sphinx] > DEFAULT
Paragraph('Issue') table_no_body.rst:1 <paragraph>
> (0,0,0,0,10) table head cell paragraph [Sphinx] > table body cell paragraph
(0,0,0,0,9) table body cell paragraph [Sphinx] > default
(0,0,0,0,2) body [Sphinx] > default
MixedStyledText('Issue')
MixedStyledText('Issue')
SingleStyledText('Issue')

0 comments on commit 26635ef

Please sign in to comment.