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

Answer principles round 1: 0 🔴, 7 🟡; mint task ids within the engine limits, fold == into inline-tokens.ts, keep one frame per quote level, pass the list's path once

This commit is contained in:
2026-10-22 21:11:12 +02:00
committed by Lillem4n
parent 8f28d7bcc2
commit e1f37cde43
13 changed files with 88 additions and 77 deletions
+3 -3
View File
@@ -19,9 +19,9 @@ import { spellStringAttribute, unsupportedNodeShape } from '../directive/syntax.
import { spellsEmpty } from '../directive/empty-keys.ts'
import { withinEngineLimits } from '../length-bound.ts'
// A flavour's own reading of a quote and of a bullet list, which may read to several blocks.
// A flavour's own reading of a quote and of a bullet list, which may read to several blocks; `path` is the container's, `index` the list's among its blocks.
export type FlavourBlockReaders = {
bulletList: (items: readonly Block[][], reading: FlavourReading, path: ConvertErrorPath, depth: number, listIndex: number) => Result<AdfNode[]>
bulletList: (items: readonly Block[][], reading: FlavourReading, path: ConvertErrorPath, depth: number, index: number) => Result<AdfNode[]>
quote: (blocks: readonly Block[], reading: FlavourReading, path: ConvertErrorPath, depth: number) => Result<AdfNode>
}
@@ -77,7 +77,7 @@ export function readBlocks(blocks: readonly Block[], reading: Reading, path: Con
return positioned(faulted(fault, nodePath), block.position)
}
if (block.kind === 'bulletList' && reading.flavour === 'portable') {
const listed = positioned(reading.blocks.bulletList(block.items, reading, nodePath, depth, content.length), block.position)
const listed = positioned(reading.blocks.bulletList(block.items, reading, path, depth, content.length), block.position)
if (!listed.ok) return listed
for (const node of listed.value) content.push(node)
continue