You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
442 B

  1. const _ = require('lodash')
  2. const cheerio = require('cheerio')
  3. module.exports = {
  4. async render() {
  5. const $ = cheerio.load(this.input)
  6. if ($.root().children().length < 1) {
  7. return ''
  8. }
  9. for (let child of this.children) {
  10. const renderer = require(`../${_.kebabCase(child.key)}/renderer.js`)
  11. renderer.init($, child.config)
  12. }
  13. return $.html('body').replace('<body>', '').replace('</body>', '')
  14. }
  15. }