Name the position a directive name the other one spells belongs to
CI / gate (push) Successful in 8s
CI / gate (push) Successful in 8s
This commit is contained in:
@@ -2,14 +2,17 @@ import type { ConvertFault } from '../result.ts'
|
||||
import type { DirectiveSpan, Read } from './directive-syntax.ts'
|
||||
import { spellAttributes, spellLeafDirective, spellStringAttribute } from './directive-syntax.ts'
|
||||
|
||||
const name = 'text'
|
||||
export const textDirectiveName = 'text'
|
||||
|
||||
const whitespaceRun = /^(?:[ \t]+|\n+)$/
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user