Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rinohtype crashes when processing a heading-only / empty body table #420

Open
1 task done
th0mr opened this issue Oct 18, 2023 · 2 comments
Open
1 task done

Rinohtype crashes when processing a heading-only / empty body table #420

th0mr opened this issue Oct 18, 2023 · 2 comments
Labels
bug crash rinohtype aborts due to an uncaught exception

Comments

@th0mr
Copy link
Contributor

th0mr commented Oct 18, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Sphinx or rinoh output

Exception occurred:
  File "C:\Python38\lib\site-packages\rinoh\frontend_init.py", line 42, in __getattr_
    raise AttributeError('No such element: {} in {}'.format(name, self))
AttributeError: No such element: row in <rinoh.frontend.rst.nodes.TBody object at 0x0000020DFC059610>

Source files

Hi,

I'm having issues whenever rinohtype encounters a header-only table i.e. a table with a header but no rows.

The best way I could find to replicate this is with this csv-table.

RST Input:

.. csv-table::
            :header: "What", "A", "Fun", "Issue"
            :file: ./empty.csv

Where empty.csv is a completely empty file, i.e. no rows.

After experimenting, I found HTML can generate this type of table correctly. Which makes me think this could be a bug for rinoh.

HTML Output:
image

I’ve had a look through the issues and cant see anything like this that has been raised before. Is there something I can do to avoid this, or is this a bug?

I've assembled a minimal example document with this table in here. minimal.zip

It was built with python -m sphinx -M rinoh . ./build

Versions

rinohtype 0.5.5 (in development)

Sphinx 5.3.0

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]

Windows-10-10.0.19045-SP0
@th0mr th0mr added bug crash rinohtype aborts due to an uncaught exception labels Oct 18, 2023
@th0mr th0mr changed the title Rinohtype crashes when processing a heading-only / empty bodied table Rinohtype crashes when processing a heading-only / empty body table Oct 18, 2023
@brechtm
Copy link
Owner

brechtm commented Oct 28, 2023

It is likely that this case is not handled. It should be easy to check whether the table body is missing (or empty, rather) and gracefully handle this situation. If you feel up to it, please provide a PR with a test in tests_regression/rst that triggers the issue and the fix.

@th0mr
Copy link
Contributor Author

th0mr commented Nov 2, 2023

I'll have a look into this when I get some time this week 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crash rinohtype aborts due to an uncaught exception
Projects
None yet
Development

No branches or pull requests

2 participants