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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user