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

Kill adfToPlainText's cell and card mutants

This commit is contained in:
2026-11-14 21:46:14 +01:00
committed by Lillem4n
parent d5935c6ac0
commit 6f01afd4f6
2 changed files with 19 additions and 3 deletions
+3 -3
View File
@@ -116,7 +116,7 @@ function emit(writing: Writing, text: string): void {
writing.gap = 0
writing.lead = undefined
}
writing.literal = (end > 0 ? 0 : writing.literal) + (writing.cell === undefined ? text.length - end : 0)
writing.literal = (end > 0 ? 0 : writing.literal) + (text.length - end)
}
function endBeforeLineFeeds(text: string): number {
@@ -149,9 +149,9 @@ function childSteps(nodes: readonly AdfNode[], layout: Layout, depth: number, pa
// A card shows its address, or its name and then its address.
function cardText(card: AdfNode): string {
const text = shownText(card)
const text = shownText(card) ?? ''
const url = shownUrl(card)
return text === undefined || url === undefined || url === text ? text ?? '' : `${text} (${url})`
return url === undefined || url === text ? text : `${text} (${url})`
}
// An image shows its alt text, else its address, else `[image]`; then the target of the link around it, then its own address where the alt text stood in for it.