Answer the stability nits: the spellings a position hint names, and the fault its name owns
CI / gate (push) Successful in 9s

This commit is contained in:
2026-09-02 12:28:21 +02:00
parent 5defa89b8d
commit df6b19601d
5 changed files with 18 additions and 16 deletions
+3 -4
View File
@@ -2,17 +2,16 @@ import type { ConvertFault } from '../result.ts'
import type { DirectiveSpan, Read } from './directive-syntax.ts'
import { spellAttributes, spellLeafDirective, spellStringAttribute } from './directive-syntax.ts'
export const textDirectiveName = 'text'
const name = 'text'
const whitespaceRun = /^(?:[ \t]+|\n+)$/
export const textDirectiveName = name
export function spellTextDirective(text: string): string {
const name = textDirectiveName
return spellLeafDirective(name, spellAttributes([[name, spellStringAttribute(text)]]))
}
export function readTextDirective(span: DirectiveSpan): Read<string> | undefined {
const name = textDirectiveName
if (span.name !== name) return undefined
if (span.content !== undefined) return { fault: unsupported(`${name} takes no content`) }
const spelled = span.attributes.get(name)