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

Write mentions and inline cards holding data as HTML elements, not the carry

This commit is contained in:
2026-11-04 16:22:57 +01:00
parent 13a2689b0d
commit d8488407aa
11 changed files with 166 additions and 91 deletions
+3 -2
View File
@@ -15,8 +15,9 @@ const holder = "a carry element's data-adf"
export function readCarry(html: string, tag: StartTag, element: 'div' | 'span', levels: number, place: Place): ReadNode {
const json = readCarryAttributes(tag.attributes)
if (json === undefined) {
const others = classesOfElement(tag.name)
const alternative = others.length === 0 ? '' : `, or opens with class="${others.join('" or "')}"`
const others = classesOfElement(tag.name).map((name) => `"${name}"`)
const last = others.pop()
const alternative = last === undefined ? '' : `, or opens with class=${others.length === 0 ? last : `${others.join(', ')} or ${last}`}`
return refused('unmappable-html', `a <${tag.name}> of the dialect is a carry element, holding class="adf-carry" and then data-adf alone${alternative}: ${foundAt(html, tag.start)}`, html, tag.start, place)
}
const jsonAt = tag.start + carryJsonOffset(tag.name)