const start = 1; module.exports = { opf: function (name, list) { return new Promise(resolve => { function page1(list) { let html = ''; list.forEach(key => { if (startAndEnd(key)) { html += ` `; } }); return html; } function page2(list) { let html = ''; list.forEach(key => { if (startAndEnd(key)) { html += ` `; } }); return html; } let html = ` ${name} zh Amazon.com Amazon.com Amazon.com ./danshijianzong.jpg ${page1(list)} ${page2(list)} `; resolve(html); }); }, toc: function (list) { return new Promise(resolve => { function page() { let html = ''; list.forEach(key => { if (startAndEnd(key)) { html += `
  • ${key.title}
  • `; } }); return html; } let html = ` TOC

    目录

    `; resolve(html); }); }, ncx: function (name, list) { return new Promise(resolve => { function page() { let html = ''; list.forEach(key => { if (startAndEnd(key)) { html += ` ${key.title}`; } }); return html; } let html = ` ${name} Content ${page()} `; resolve(html); }); }, page: function (item, content) { return new Promise(resolve => { const html = `

    ${content.title}

    ${content.page}

    `; resolve(html); }); }, name: '择天记' }; function startAndEnd(item) { return item.index > 0 && item.index < 605; }