mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-20 07:05:44 +01:00
Kill the wiki writer's surviving mutants and drop checks the schema already makes
This commit is contained in:
@@ -106,7 +106,7 @@ function headingSpelling(node: AdfNode, path: ConvertErrorPath): Result<Spelling
|
||||
}
|
||||
|
||||
function simpleLeafText(node: AdfNode): string | undefined {
|
||||
if (node.type === 'rule') return holdsExactly(node, {}) && node.content === undefined ? '----' : undefined
|
||||
if (node.type === 'rule') return holdsExactly(node, {}) ? '----' : undefined
|
||||
if (node.type === 'codeBlock') return codeText(node)
|
||||
return node.type === 'mediaSingle' && holdsExactly(node, { layout: 'center' }) ? imageText(nodeContent(node)) : undefined
|
||||
}
|
||||
@@ -123,7 +123,7 @@ function codeText(node: AdfNode): string | undefined {
|
||||
|
||||
function imageText(content: readonly AdfNode[]): string | undefined {
|
||||
const [media, ...others] = content
|
||||
if (media?.type !== 'media' || others.length > 0 || media.content !== undefined || !holdsOnlyAttributes(media, ['alt', 'type', 'url'])) return undefined
|
||||
if (media?.type !== 'media' || others.length > 0 || !holdsOnlyAttributes(media, ['alt', 'type', 'url'])) return undefined
|
||||
const { alt, type, url } = nodeAttrs(media)
|
||||
if (type !== 'external' || typeof url !== 'string' || !spellableImageUrl.test(url)) return undefined
|
||||
if (alt === undefined) return `!${url}!`
|
||||
|
||||
Reference in New Issue
Block a user