3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 07:32:58 +01:00

21 - the ADF tables carry ADF's nouns

This commit is contained in:
2026-09-21 21:39:59 +02:00
parent 4f4302b5ba
commit 4036b677ed
16 changed files with 111 additions and 102 deletions
@@ -1,10 +1,10 @@
import type { AdfNode } from '../../adf/document.ts'
import type { InlineDirective } from '../../adf/inline-directives.ts'
import type { InlineNode } from '../../adf/inline-nodes.ts'
import { nodeAttrs } from '../../adf/document.ts'
import { spellAttributes, spellVocabulary } from '../directive-syntax.ts'
import { vocabularyPairs } from '../../adf/attribute-vocabulary.ts'
export function spellInlineNodeAttributes(node: AdfNode, directive: InlineDirective): string | undefined {
const pairs = vocabularyPairs(nodeAttrs(node), directive.attributes, directive.textAttribute === undefined ? [] : [directive.textAttribute])
export function spellInlineNodeAttributes(node: AdfNode, inlineNode: InlineNode): string | undefined {
const pairs = vocabularyPairs(nodeAttrs(node), inlineNode.attributes, inlineNode.textAttribute === undefined ? [] : [inlineNode.textAttribute])
return pairs === undefined ? undefined : spellAttributes(spellVocabulary(pairs))
}