mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-18 22:25:44 +01:00
Answer product-owner round 1: 0 🔴, 1 🟡 (0 misread); show how a page restores cell colours, name data-background-color in the cell style refusal
This commit is contained in:
@@ -22,6 +22,17 @@ class that keeps its fields behind getters (Vue 2, MobX) is refused too: hand in
|
||||
`JSON.parse(JSON.stringify(document))`. A document holding more than 10,000,000 JSON values is
|
||||
`unsupported-node-shape`.
|
||||
|
||||
`adfToHtml` writes a table cell's background as `data-background-color="…"`, where `0.3.1` wrote
|
||||
`style="background-color:…"`. A page that shows the HTML loses the cell's colour unless it sets the colour from
|
||||
the attribute, as this script does for cells and for colour marks:
|
||||
|
||||
```js
|
||||
for (const element of document.querySelectorAll('[data-background-color]')) element.style.backgroundColor = element.dataset.backgroundColor
|
||||
for (const element of document.querySelectorAll('[data-text-color]')) element.style.color = element.dataset.textColor
|
||||
```
|
||||
|
||||
`htmlToAdf` still reads the HTML `0.3.1` wrote.
|
||||
|
||||
`portableMarkdownToAdf` reads more of GFM's pipe table:
|
||||
|
||||
- A body row holding fewer cells than the header is padded with empty cells, where `0.3.1`
|
||||
|
||||
@@ -34,7 +34,7 @@ export function readCellAttributes(pairs: readonly (readonly [string, string])[]
|
||||
const released = name === 'data-background-color' && first?.[0] === 'style'
|
||||
if (first?.[0] !== name && !released) continue
|
||||
const value = released ? releasedBackground.exec(first[1])?.[1] : ownValue(name, first[1])
|
||||
if (value === undefined) return { fault: { code: name === 'data-colwidth' ? 'unsupported-node-shape' : 'unmappable-html', message: `${first[0]} on <${element}> spells no value adfToHtml writes there` } }
|
||||
if (value === undefined) return { fault: { code: name === 'data-colwidth' ? 'unsupported-node-shape' : 'unmappable-html', message: released ? `style on <${element}> holds background-color:, then letters and digits after an optional #, as 0.3.1 wrote it; adfToHtml writes data-background-color` : `${name} on <${element}> spells no value adfToHtml writes there` } }
|
||||
attrs[ownKey(name)] = value
|
||||
rest = rest.slice(1)
|
||||
}
|
||||
|
||||
@@ -745,17 +745,18 @@ const pinnedRefusals: readonly (readonly [string, string])[] = [
|
||||
['<p data-indent-level="0">a</p>\n', 'unmappable-html at /content/0: data-indent-level on <p> holds a whole number from 1 to 6'],
|
||||
['<p data-indent-level="02">a</p>\n', 'unmappable-html at /content/0: data-indent-level on <p> holds a whole number from 1 to 6'],
|
||||
['<p data-indent-level="1.5">a</p>\n', 'unmappable-html at /content/0: data-indent-level on <p> holds a whole number from 1 to 6'],
|
||||
['<p data-indent-level="2" data-align="center">a</p>\n', 'unmappable-html at /content/0: <p> takes one of data-align and data-indent-level, first, before its data-* attributes'],
|
||||
['<p data-indent-level="2" data-align="center">a</p>\n', 'unmappable-html at /content/0: <p> holds at most one of data-align and data-indent-level, as its first attribute'],
|
||||
['<blockquote data-indent-level="2">\n<p>a</p>\n</blockquote>\n', 'unsupported-node-shape at /content/0: <blockquote> takes no data-indent-level attribute'],
|
||||
['<h3 data-indent-level="">a</h3>\n', 'unmappable-html at /content/0: data-indent-level on <h3> holds a whole number from 1 to 6'],
|
||||
['<p data-local-id="p1" data-indent-level="2">a</p>\n', 'unmappable-html at /content/0: <p> takes one of data-align and data-indent-level, first, before its data-* attributes'],
|
||||
['<p data-indent-level="2" data-indent-level="2">a</p>\n', 'unmappable-html at /content/0: <p> takes one of data-align and data-indent-level, first, before its data-* attributes'],
|
||||
['<p data-align="center" data-indent-level="2">a</p>\n', 'unmappable-html at /content/0: <p> takes one of data-align and data-indent-level, first, before its data-* attributes'],
|
||||
['<p data-local-id="p1" data-indent-level="2">a</p>\n', 'unmappable-html at /content/0: <p> holds at most one of data-align and data-indent-level, as its first attribute'],
|
||||
['<p data-indent-level="2" data-indent-level="2">a</p>\n', 'unmappable-html at /content/0: <p> holds at most one of data-align and data-indent-level, as its first attribute'],
|
||||
['<p data-align="center" data-indent-level="2">a</p>\n', 'unmappable-html at /content/0: <p> holds at most one of data-align and data-indent-level, as its first attribute'],
|
||||
['<details class="adf-expand" open="" open="">\n<p>a</p>\n</details>\n', 'unmappable-html at /content/0: <details> takes open="" once, after its other attributes'],
|
||||
['<p>a <span title="color:red">b</span></p>\n', 'unmappable-html at /content/0/content/1: a <span> of the dialect is a carry element, holding class="adf-carry" and then data-adf alone, opens with class="adf-emoji", "adf-mention" or "adf-status", or holds data-text-color alone: found "<span title=\\"color:red\\">"…'],
|
||||
['<p>a <span style="color:red">b</span></p>\n', 'unmappable-html at /content/0/content/1: a <span> of the dialect is a carry element, holding class="adf-carry" and then data-adf alone, opens with class="adf-emoji", "adf-mention" or "adf-status", or holds data-text-color alone: found "<span style=\\"color:red\\">"…'],
|
||||
['<p>a <mark style="background-color:red">b</mark></p>\n', 'unmappable-html at /content/0/content/1: a <mark> of the dialect holds data-background-color alone: found "<mark style=\\"background-"…'],
|
||||
['<table>\n<tbody>\n<tr><td style="background-color:url(x)">a</td></tr>\n</tbody>\n</table>\n', 'unmappable-html at /content/0/content/0/content/0: style on <td> spells no value adfToHtml writes there'],
|
||||
['<table>\n<tbody>\n<tr><td rowspan="x">a</td></tr>\n</tbody>\n</table>\n', 'unmappable-html at /content/0/content/0/content/0: rowspan on <td> spells no value adfToHtml writes there'],
|
||||
['<table>\n<tbody>\n<tr><td style="background-color:url(x)">a</td></tr>\n</tbody>\n</table>\n', 'unmappable-html at /content/0/content/0/content/0: style on <td> holds background-color:, then letters and digits after an optional #, as 0.3.1 wrote it; adfToHtml writes data-background-color'],
|
||||
['<table>\n<tbody>\n<tr><td data-colwidth="1" data-background-color="red">a</td></tr>\n</tbody>\n</table>\n', 'unmappable-html at /content/0/content/0/content/0: <td> takes colspan, rowspan, data-background-color and data-colwidth first, each once and in that order: found data-background-color out of place'],
|
||||
['<p>a <mark>b</mark></p>\n', 'unmappable-html at /content/0/content/1: a <mark> of the dialect holds data-background-color alone: found "<mark>b</mark></p>\\n"'],
|
||||
['<blockquote><p>a</p></blockquote>\n', 'unmappable-html at /content/0: <blockquote> holds </blockquote> straight after it, or a line feed and its first block: found "<p>a</p></blockquote>\\n"'],
|
||||
|
||||
Reference in New Issue
Block a user