brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
506 stars 61 forks source link

Issue #420 - Fix for empty table body crash #422

Closed th0mr closed 11 months ago

th0mr commented 1 year ago

Hi,

I've put together a fix for the empty table body crash from issue #420. I've done this by mostly copying the code rinoh uses when it encounters a table with an empty header and I've applied it to tables with empty bodies.

This seems to fix the behavior so that it simply produces a table with only the header. image

As for a regression test, I failed to get one made as I could not quite get a comparison pdf created in the same "minimal template" style produced by the nox run. Maybe I'm missing something obvious but what is the best way to generate the pdf files in this style for these tests?

Just so its written down somewhere, the test content looks like:

.. csv-table::
    :header: "This", "table", "has", "no", "body", "rows!"
    :file: ./empty_body_table.csv

Where empty_body_table.csv is just an empty file

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

brechtm commented 11 months ago

Thanks, @th0mr!

I added a test in 26635ef4f4ca720720c2d1d35be138dd3a4fd014. Once a fix is implemented, you can just copy the generated known-good PDF output alongside the rst file. I hope this answers your question?