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:
@@ -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 }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user