Skip to content

Table layout: headings-only tables and simple-table column widths - #184

Merged
krperry merged 2 commits into
mainfrom
fix/table-layout
Oct 20, 2026
Merged

krperry merged 2 commits into
mainfrom
fix/table-layout

Conversation

@krperry

@krperry krperry commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Two table formatter fixes, one commit each.

1. A table of headings only

An LWS transaction table with no transactions has only its heading row. A wide one fell back to literary formatting, one heading per line. A narrower one became a simple table with columns too narrow for its headings: a word was divided without a hyphen, and a separation line was added under nothing.

Now the headings go on one line, two spaces apart and with no separation line, when they fit. Otherwise they are one listed entry: the first heading, a colon, then the others separated by semicolons, at cell 1 with runovers at cell 3, as Duxbury writes them. Braille Formats 2016 has no rule for a table with no entries; 11.16.1(f) gives 1-3 margins for a heading with a single entry.

2. Simple-table column widths

calculateColumnWidths split the line evenly and handed spare cells to columns whose entries ran over, even when the extra cells couldn't stop them running over. The columns came out wider than Duxbury's, with longer separation lines, headings divided to suit the wider column, and guide dots in the gaps.

Braille Formats 11.2.5.c says a column is as wide as its widest entry. When the columns don't fit at that width, each now starts as narrow as its heading and entries allow on two lines (11.4.1, 11.6.1), never narrower than its longest word. Spare cells only go to a column where they let one more entry fit on one line, the cheapest first. The separation line follows the column width, and a heading divides to suit it. Facing tables, and tables whose narrowest columns don't fit, keep the old calculation.

In the Braille Formats samples this keeps "Williamson's" whole and lets every row heading of the weather table fit on one line.

Tests

  • utd: HeadingsOnlyTableTest, SimpleTableColumnWidthTest, and an updated SimpleTableGuideDotsTest. The shared harness moves to TableTestUtils.
  • core: DocxTableSpacingTest.

An LWS transaction table with no transactions has only its heading row.
A wide one fell back to literary formatting, one heading per line; a
narrower one became a simple table with columns too narrow for its
headings, dividing a word without a hyphen and adding a separation line
under nothing.

Now the headings go on one line, two spaces apart and with no separation
line, when they fit. Otherwise they are one listed entry: the first
heading, a colon, the others separated by semicolons, at cell 1 with
runovers at cell 3, as Duxbury writes them. Braille Formats 2016 has no
rule for a table with no entries; 11.16.1(f) gives 1-3 margins for a
heading with a single entry.

The table layout tests' harness moves to TableTestUtils so the new tests
can share it.
calculateColumnWidths split the line evenly and handed spare cells to
columns whose entries ran over, even when the extra cells could not stop
them running over. The columns came out wider than Duxbury's, with longer
separation lines, headings divided to suit the wider column, and guide
dots in the gaps.

Braille Formats 11.2.5.c: a column is as wide as its widest entry. When
the columns don't fit at that width, each now starts as narrow as its
heading and entries allow on two lines (11.4.1, 11.6.1), never narrower
than its longest word, and spare cells only go to a column they let one
more entry fit on one line, the cheapest first. The separation line
follows the column width, and a heading divides to suit it. Facing
tables and tables whose narrowest columns don't fit keep the old
calculation.

In the Braille Formats samples this keeps "Williamson's" whole and lets
every row heading of the weather table fit on one line.
@krperry
krperry merged commit 3f7d739 into main Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant