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

Answer principles round 1: 3 🔴, 8 🟡 (0 misread); attributes as data-*, carried content as paragraphs, links and notes, no character HTML cannot hold, mutants killed

This commit is contained in:
2026-10-23 19:19:14 +02:00
committed by Lillem4n
parent 1f46111fe4
commit 7a38db2563
27 changed files with 612 additions and 295 deletions
+4 -4
View File
@@ -38,19 +38,19 @@ export function markSpelling(type: string): MarkSpelling | undefined {
}
export function linkMark(definition: LinkDefinition): AdfMark {
return linkMarkFrom(definitionAttrs(definition))
return linkMarkFrom(toLinkAttrs(definition))
}
export function definitionAttrs({ destination, title }: LinkDefinition): LinkAttrs {
export function toLinkAttrs({ destination, title }: LinkDefinition): LinkAttrs {
return title === undefined ? { href: destination } : { href: destination, title }
}
export function linkDefinition(attrs: AdfAttributes): LinkDefinition | undefined {
const target = linkAttrs(attrs)
return target === undefined ? undefined : attrsDefinition(target)
return target === undefined ? undefined : toLinkDefinition(target)
}
export function attrsDefinition({ href, title }: LinkAttrs): LinkDefinition {
export function toLinkDefinition({ href, title }: LinkAttrs): LinkDefinition {
return title === undefined ? { destination: href } : { destination: href, title }
}