Repository navigation
Table layout: headings-only tables and simple-table column widths - #184
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
calculateColumnWidthssplit 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
HeadingsOnlyTableTest,SimpleTableColumnWidthTest, and an updatedSimpleTableGuideDotsTest. The shared harness moves toTableTestUtils.DocxTableSpacingTest.