mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-16 21:30:25 +01:00
Answer prose round 1: 0 🔴, 2 🟡; the slot's rule joins the node-tables bullet, the remedies offer the space alike, the message says lines
This commit is contained in:
@@ -105,9 +105,9 @@ export function readSoleStringAttribute(span: DirectiveSpan, key: string): Read<
|
||||
return { value: spelled.decoded }
|
||||
}
|
||||
|
||||
// An inline directive never spans lines, and no content slot holds a null character; the emitter carries such a node.
|
||||
// The emitter carries such a node.
|
||||
export function slotFault(type: string, text: string): ConvertFault | undefined {
|
||||
if (/[\n\r]/.test(text)) return unsupportedNodeShape(`the ${type} content slot holds a line ending, which no inline directive spans: replace it with a space, or write the node as !adf:carry`)
|
||||
if (/[\n\r]/.test(text)) return unsupportedNodeShape(`the ${type} content slot holds a line ending, and an inline directive never spans lines: replace it with a space, or write the node as !adf:carry`)
|
||||
return holdsNullCharacter(text) ? unsupportedNodeShape(`the ${type} content slot holds a null character: write the node as !adf:carry`) : undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -1103,7 +1103,7 @@ test('names the content slot no lone plain text node reads back from', () => {
|
||||
assert.equal(code(losslessMarkdownToAdf('!adf:status[<div>]{color=yellow}\n')), 'unmappable-html')
|
||||
assert.equal(code(losslessMarkdownToAdf('!adf:date[<div>]{timestamp=1}\n')), 'unmappable-html')
|
||||
assert.equal(code(losslessMarkdownToAdf('!adf:widget[<div>]\n')), 'unmappable-html')
|
||||
const spans = 'unsupported-node-shape: the status content slot holds a line ending, which no inline directive spans: replace it with a space, or write the node as !adf:carry'
|
||||
const spans = 'unsupported-node-shape: the status content slot holds a line ending, and an inline directive never spans lines: replace it with a space, or write the node as !adf:carry'
|
||||
assert.equal(content(losslessMarkdownToAdf('!adf:status[!adf:text{text="\\n"}]{color=yellow}\n')), spans)
|
||||
assert.equal(content(losslessMarkdownToAdf('!adf:status[a b]{color=yellow}\n')), spans)
|
||||
assert.equal(content(losslessMarkdownToAdf('!adf:status[a b]{color=yellow}\n')), spans)
|
||||
|
||||
Reference in New Issue
Block a user