const _ = require('lodash') module.exports = { async init($, config) { for (let i = 1; i < 6; i++) { $(`h${i}.tabset`).each((idx, elm) => { let content = `` let tabs = [] let tabContents = [] $(elm).nextUntil(_.times(i, t => `h${t + 1}`).join(', '), `h${i + 1}`).each((hidx, hd) => { tabs.push(`
  • ${$(hd).html()}
  • `) let tabContent = '' $(hd).nextUntil(_.times(i + 1, t => `h${t + 1}`).join(', ')).each((cidx, celm) => { tabContent += $.html(celm) $(celm).remove() }) console.info(tabContent) tabContents.push(`
    ${tabContent}
    `) $(hd).remove() }) content += `` content += `` content += `
    ` $(elm).replaceWith($(content)) }) } } }