mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-21 07:32:58 +01:00
Answer prose round 1: a task item keeps the task lists right after its paragraphs nested, and the README, changelog, decision, comment, item 49 and a test title say it plainly
This commit is contained in:
@@ -304,17 +304,17 @@ function reduceTaskList(node: AdfNode, reduction: Reduction): Result<AdfNode[]>
|
||||
continue
|
||||
}
|
||||
if (isTask(child)) {
|
||||
nestIn(tasks, nested)
|
||||
pushMerged(tasks, nested)
|
||||
nested = []
|
||||
}
|
||||
for (const block of blocks) (isTask(child) ? tasks : nested).push(block)
|
||||
}
|
||||
nestIn(tasks, nested)
|
||||
pushMerged(tasks, nested)
|
||||
if (regular) return success(splitTaskList({ content: tasks, type: 'taskList' }))
|
||||
return success(listOf(nodeContent(tasksAsText({ content: tasks, type: 'taskList' })), 'bulletList'))
|
||||
}
|
||||
|
||||
function nestIn(tasks: AdfNode[], nested: readonly AdfNode[]): void {
|
||||
function pushMerged(tasks: AdfNode[], nested: readonly AdfNode[]): void {
|
||||
for (const block of mergedLists(nested)) tasks.push(block)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user