Repository navigation
JSE-F3: carry a group title right over its sub-columns without merges - #118
Merged
Merged
Conversation
A multi-row header without merges (CSV) writes a group title once, over
the first of its columns: "Name,Q1," over ",Jan,Feb". toDataset's
headerRows flattening read that as "Name", "Q1 / Jan", "Feb".
An empty, unmerged cell in an upper header row now takes the nearest
non-empty cell to its left in that row, when the column has text in a
lower header row. The fill stops at the table's first column and at a
merged cell (a real merge already gives the extent), so merged headers
and units rows ("Temp" over "°C") are unchanged.
Tests: toCsv of fromDataset header groups imports back with the
original titles; units rows, leading empty cells, columns without
lower text and merges. docs/api.md 4.3 describes the rule.
4 tasks
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.
In a multi-row header without merges, which is always the case in CSV, a group title is written once, over the first of its columns:
Name,Q1,over,Jan,Feb.toDataset'sheaderRowsflattening, whichimportDatasetuses, turned that intoName,Q1 / Jan,Feb.Rule (
multiRowTitlesinsrc/dataset.ts)An empty, unmerged cell in an upper header row takes the nearest non-empty cell to its left in the same row, but only when that column has text in a lower header row (so it is a sub-column).
Namestays empty.fromDataset) are unchanged.Tempover°C) have no empty upper cells, so they are unchanged.Name,Q1,/,Jan,FebName,Q1 / Jan,FebName,Q1 / Jan,Q1 / Feb,,Q1,,/Name,City,Jan,Feb,Name,City,Q1 / Jan,Feb, ``Name,City,Q1 / Jan,Q1 / Feb, ``Temp,Pressure/°C,hPaName,Q1 (merged B:C),/,Jan,Feb,NotesName,Q1 / Jan,Q1 / Feb,NotesTests
toCsv(fromDataset(...header groups...))thenimportDatasetdetects rows[0, 1]with high confidence, and gives backName,Q1 / Jan…Q2 / May,Noteswith the right values.toDatasetcases: group titles, leading empty cells, a column with no lower text, a units row, and a merge that wins over the fill.two-header-rows.csvdetection, which JSE-F2 (JSE-F2: detect two-row headers without merges (CSV) #117) already changed. That file has no empty upper cells, so this PR doesn't touch it.docs/api.md§4.3 describes the rule. Patch changeset.