[html] fix failure from colspan with only td tags #2002
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When an HTML table has colspan, with only td tags, the visidata rows contain invalid data for the resulting empty cells, and the table can't be viewed.
More specifically, cells in a row created by the html loader should be tuples like
(cellval, links)
:visidata/visidata/loaders/html.py
Line 146 in d0e8a35
But for empty cells, what
iterload()
adds to the row is aNone
object, not a tuple. That causes the following exception that makes the table unviewable:Here is an example file to reproduce the error: td_colspan.html.txt
It can be viewed with
vd -f html td_colspan.html.txt
This PR fixes that issue and allows the table to be viewed.
The resulting table will still show errors for the empty cells, which I did not attempt to fix. They are the same errors already covered by #1308 , but caused by colspan instead of the rowspan that the open issue discusses.