'))
43 | const container = this.parseContent(this.createBlock(parent, 'open'), reader)
44 | const sourceTabs = container.getBlocks()[0]
45 | if (!(sourceTabs && sourceTabs.getContext() === 'dlist' && sourceTabs.getItems().length)) return
46 | const tabs = List.$new(parent, 'ulist')
47 | tabs.addRole('tabs')
48 | const panes = {}
49 | sourceTabs.getItems().forEach(([[title], details]) => {
50 | const tab = ListItem.$new(tabs)
51 | tabs.$append(tab)
52 | const id = generateId(title.getText(), tabsetIdx)
53 | tab.text = `[[${id}]]${title.text}`
54 | let blocks = details.getBlocks()
55 | const numBlocks = blocks.length
56 | if (numBlocks) {
57 | if (blocks[0].context === 'open' && numBlocks === 1) blocks = blocks[0].getBlocks()
58 | panes[id] = blocks.map((block) => (block.parent = parent) && block)
59 | }
60 | })
61 | nodes.push(tabs)
62 | nodes.push(createHtmlFragment('
'))
63 | Object.entries(panes).forEach(([id, blocks]) => {
64 | nodes.push(createHtmlFragment(`
`))
65 | nodes.push(...blocks)
66 | nodes.push(createHtmlFragment('
'))
67 | })
68 | nodes.push(createHtmlFragment('