Skip to main content

Module grid

Module grid 

Source
Expand description

Where a table’s cells sit on its grid.

Every parser in the family records a merged cell once, on the cell that owns it: the positions it covers — the tail of a horizontal span, and the columns a vertical span occupies in the rows below — have no cell of their own. So a cell’s index in its row is not its grid column once a vertical span from a row above sits to its left, and a row’s cell count is not the table’s width once a cell spans columns. place walks the spans to recover both — the same walk whatever the document format was, done here once.

std-only, like the rest of the crate root.

Structs§

Placement
Where each cell of a table sits: see place.
Span
How many grid rows and columns a cell owns, its own position included. A span of 0 is read as 1; one past MAX_ROW_SPAN or MAX_COL_SPAN as that bound.

Constants§

MAX_COL_SPAN
The most columns place lets one cell own: a larger span is read as this many.
MAX_ROW_SPAN
The most rows place lets one cell own, the value HTML clamps rowspan to. A row span costs no allocation here — it only counts down rows that exist — but is read the same way HTML reads it, so a renderer that lays rows out itself can share the bound.

Functions§

place
The grid column each cell starts in, and the table’s width, for rows given as their cells’ spans in reading order.