asciidoc writer: Add more table features#11267
Conversation
200a7d1 to
a44e399
Compare
|
This is great! Two suggestions:
|
This adds the following table features: - row span and column span - footer row - individual horizontal cell alignment [API change] T.P.Writers.Shared: Add functions `allRowsEmpty` and `tableBodiesToRows` from the RST writer for reuse in other writers. Also fix hlint warning about `unzip` from `NonEmpty`: The exported polymorphic function will become monomorphic in the future. Restrict the `NonEmpty` import to use the Prelude `unzip` function.
a44e399 to
a7e4585
Compare
|
I added the missing I replaced most of the source tables with HTML. I kept the test for cell aligments native due to the HTML reader inferring default column alignments that I don't think fit a test about individual cell alignments. I also kept the test for empty rows native due to the HTML reader proactively adding empty cells rather than keeping the row empty. This HTML table: gets parsed as: Is this a bug? I don't think it's correct that an empty row is parsed as a row with an empty cell. |
|
I also noticed that the HTML writer is not preserving the empty row. This native table: is converted to this HTML table: I also don't think that this is right either. The empty row should be preserved, right? |
|
I agree that these things seem like bugs, but there might be a reason for them that I've either forgotten or never knew (because someone else wrote that code). |
This adds the following table features:
In addition to handling row spans in headers and footer as described in #7326 (comment) I also had to handle row spans over empty rows. You can't really write an empty row in asciidoc but a row span that would go into an empty row still has to be handled. Otherwise the row span wouldn't add up.
I made those row spans basically consume empty rows. Whenever there are row spans that would go over an empty row, that empty row is removed and the row span is decremented. This corrects the row span count in the asciidoc output and handles empty rows.
Any empty rows that remain get filled up with empty columns.
T.P.Writers.Shared: Add functions
allRowsEmptyandtableBodiesToRowsfrom the RST writer for reuse in the asciidoc writer.I got hlint warnings about
NonEmptyandunzip: CurrentlyNonEmptyexports a polymorphicunzipfunction but that will become monomorphic in base-4.22 (https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List-NonEmpty.html#v:unzip). To avoid any hassles in the future I restricted theNonEmptyimports so that the Preludeunzipfunction is used.Fixes: #7326
Fixes: #8199