-
-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Problem
When a table has cols= specified, the parser validates that each row has the correct number of columns. However, with rowspan cells, subsequent rows should have fewer visible cells because some column positions are "occupied" by the spanning cell from a previous row.
Currently, rows under a rowspan trigger a warning about incorrect column count when they correctly have fewer visible cells.
Example
[cols="3*"]
|===
| A | B | C
.2+| Spans rows | D | E
| F | G
| H | I | J
|===Row 3 (| F | G) correctly has only 2 visible cells because column 1 is occupied by the rowspan from row 2. But with strict cols=3 validation, this would warn.
Solution
Track "occupied" column positions using a Vec<usize> where each entry represents rows remaining for that column's rowspan. When processing a row:
- Decrement all non-zero entries
- When placing a cell, skip occupied positions
- Validate: visible cells + occupied positions + (colspan-1 for each cell) = ncols
Priority
Medium - current implementation works for most cases, this is an edge case with strict column count validation.
Related
- Implements follow-up from Tables: Implement cell spanning (colspan/rowspan) #276