File size: 701 Bytes
be5030f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict'
const Section = require('./section')

class ContentSection extends Section {
  constructor (section) {
    super()
    this.header(section.header)

    if (section.content) {
      /* add content without indentation or wrapping */
      if (section.raw) {
        const arrayify = require('array-back')
        const chalkFormat = require('./chalk-format')
        const content = arrayify(section.content).map(line => chalkFormat(line))
        this.add(content)
      } else {
        const Content = require('./content')
        const content = new Content(section.content)
        this.add(content.lines())
      }

      this.emptyLine()
    }
  }
}

module.exports = ContentSection