mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-18 22:25:44 +01:00
Answer prose round 1: 0 🔴, 6 🟡 (0 misread); mark the cell background breaking, reword the panel entries and the alignment refusal
This commit is contained in:
+6
-5
@@ -8,11 +8,12 @@
|
||||
mark. The carry element `0.3.1` wrote for them still reads.
|
||||
- `adfToHtml` writes underline as `<u>`, subscript and superscript as `<sub>` and `<sup>`, a text colour as
|
||||
`<span data-text-color="…">`, a background colour as `<mark data-background-color="…">` and a paragraph's or
|
||||
heading's alignment as `data-align="center"` or `data-align="end"`, where `0.3.1` wrote the carry element, and `htmlToAdf` reads them
|
||||
back. The carry element `0.3.1` wrote for them still reads.
|
||||
- `adfToHtml` writes a table cell's background as `data-background-color="…"`, where `0.3.1` wrote
|
||||
`style="background-color:…"`, so the HTML holds no `style` attribute. `htmlToAdf` still reads the `0.3.1` spelling.
|
||||
A background that isn't letters and digits after an optional `#` is written too, where it rode the carry element.
|
||||
heading's alignment as `data-align="center"` or `data-align="end"`, where `0.3.1` wrote the carry element,
|
||||
and `htmlToAdf` reads them back. The carry element `0.3.1` wrote for them still reads.
|
||||
- **Breaking:** `adfToHtml` writes a table cell's background as `data-background-color="…"`, where `0.3.1` wrote
|
||||
`style="background-color:…"`, so the HTML holds no `style` attribute and a browser no longer shows the colour
|
||||
unaided. `htmlToAdf` still reads the `0.3.1` spelling. A table whose cell background isn't letters and digits after
|
||||
an optional `#` is written too, where `0.3.1` wrote the whole table as the carry element.
|
||||
- `htmlToAdf` names every spelling of the dialect's `<div>`, `<span>` and `<mark>` in the refusal of one it can't
|
||||
read.
|
||||
- `adfToHtml` writes a paragraph's or heading's indentation as `data-indent-level="2"`, where `0.3.1` wrote the carry
|
||||
|
||||
+8
-6
@@ -486,9 +486,10 @@ A sixth panel (2026-11-05, three readers in the same roles) picked each of these
|
||||
- a first row of header cells alone in `<thead>` and the rest in `<tbody>`, a row to a line, over a
|
||||
bare `<table>` of `<tr>` rows and over a line per cell;
|
||||
- a cell's first paragraph bare, `<td>Bolt M8</td>`, as a list item's;
|
||||
- a cell's attributes as `<td colspan="2" rowspan="2">` and `data-*` attributes, over `data-*` for all four; its
|
||||
`style="background-color:…"` gave way to the ninth panel's spelling, and `htmlToAdf` still reads it, since
|
||||
`0.3.1` wrote it and every other spelling `0.3.1` wrote still reads.
|
||||
- a cell's `colspan` and `rowspan` as `<td colspan="2" rowspan="2">`, over `data-*` attributes for them.
|
||||
|
||||
The sixth panel also picked `style="background-color:…"` for a cell's background. The ninth panel's spelling
|
||||
replaced it. `htmlToAdf` still reads it, since `0.3.1` wrote it and every other spelling `0.3.1` wrote still reads.
|
||||
|
||||
A seventh panel (2026-11-14, three readers in the same roles, after the reader panel of §The feature
|
||||
table is a section per corpus example, led by a summary table expected `<s>` or `<del>`) picked
|
||||
@@ -520,10 +521,11 @@ naming what it holds, over a class beside it and over a class per value:
|
||||
- `data-align="center"` and `data-align="end"` for an `alignment`, ADF's own values;
|
||||
- `<span data-text-color="#bf2600">` and `<mark data-background-color="#fffae6">`, over a bare
|
||||
`data-color` that could name either;
|
||||
- `<td data-background-color="#fffae6">` for a cell's `background`, the highlight's name over ADF's.
|
||||
- `<td data-background-color="#fffae6">` for a cell's `background`, the name the background colour mark takes,
|
||||
over ADF's attribute name.
|
||||
|
||||
Out of `style`, a colour needs no restriction to stay in its attribute, so any string HTML can hold
|
||||
is one.
|
||||
A colour outside `style` cannot break out of its attribute, so `adfToHtml` writes any colour string HTML can
|
||||
hold.
|
||||
|
||||
## `htmlToAdf` also reads the dialect as a browser serializes it
|
||||
|
||||
|
||||
+2
-2
@@ -196,8 +196,8 @@ what it shows too:
|
||||
| a line feed | `\r\n` |
|
||||
| an expand's or nested expand's `<details>` | the same with `open=""` after its other attributes, which a browser writes for one its user opened; it reads as the same expand, the open state dropped |
|
||||
|
||||
`htmlToAdf` also reads a cell's `background` as `0.3.1` wrote it, `style="background-color:#fffae6"` in
|
||||
the place of `data-background-color`, the colour a `#` and letters and digits, or letters and digits alone.
|
||||
`htmlToAdf` also reads a cell's `background` as `0.3.1` wrote it: `style="background-color:#fffae6"`, where
|
||||
`data-background-color` stands. The colour is letters and digits after an optional `#`.
|
||||
|
||||
A refusal's position counts the HTML as handed in. `htmlToAdf` reads a carry element's node from its
|
||||
`data-adf`, and what the element shows, through its closing tag, must be what `adfToHtml` shows for
|
||||
|
||||
@@ -35,7 +35,7 @@ export function readTextBlockAttributes(pairs: readonly (readonly [string, strin
|
||||
const mark = first === undefined ? undefined : readMark(first, element)
|
||||
if (mark?.fault !== undefined) return mark
|
||||
const rest = mark === undefined ? pairs : pairs.slice(1)
|
||||
if (rest.some(([name]) => name === alignAttribute || name === indentAttribute)) return { fault: { code: 'unmappable-html', message: `<${element}> takes one of ${alignAttribute} and ${indentAttribute}, first, before its data-* attributes` } }
|
||||
if (rest.some(([name]) => name === alignAttribute || name === indentAttribute)) return { fault: { code: 'unmappable-html', message: `<${element}> holds at most one of ${alignAttribute} and ${indentAttribute}, as its first attribute` } }
|
||||
const data = readDataAttributes(rest, element, vocabulary, written)
|
||||
if (data.fault !== undefined) return data
|
||||
return { value: { attrs: data.value, marks: mark === undefined ? [] : [mark.value] } }
|
||||
|
||||
Reference in New Issue
Block a user