3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 06:35:44 +01:00

Answer architecture round 4: the forecast and the indent leave, a writer refuses a document whose text alone passes the bound, and the joins are the one bound left

This commit is contained in:
2026-10-12 18:03:58 +02:00
committed by Lillem4n
parent ae1a47f1bc
commit a0bb09b80d
17 changed files with 110 additions and 141 deletions
+1 -12
View File
@@ -131,18 +131,7 @@ export function spellDirectiveCloser(name: string): string {
}
export function spellDirectiveOpener(name: string, argument: string | undefined, attributes: string): string {
return [...directiveOpenerPieces(name, argument, attributes === '' ? [] : [attributes])].join('')
}
export function* directiveOpenerPieces(name: string, argument: string | undefined, attributes: Iterable<string>): Generator<string> {
yield `${directivePrefix}${name}`
if (argument !== undefined) yield ` ${argument}`
let first = true
for (const piece of attributes) {
if (first) yield ' '
first = false
yield piece
}
return `${directivePrefix}${name}${argument === undefined ? '' : ` ${argument}`}${attributes === '' ? '' : ` ${attributes}`}`
}
export function spellJsonAttribute(value: JsonValue): string {