Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 8x 4x 1x | const util = require( './util.js' ), View = require( './View' ); /** * Builds a section of a page */ class Section extends View { /** * @param {Object} options Configuration options */ constructor( options ) { options.tag = 'h' + options.level; super( options ); this.line = options.line; this.text = options.text; this.hasReferences = options.hasReferences || false; this.id = options.id || null; this.anchor = options.anchor; this.subsections = []; ( options.subsections || [] ).forEach( ( section ) => this.subsections.push( new Section( section ) ) ); } get template() { return util.template( ` <h{{level}} id="{{anchor}}">{{{line}}}</h{{level}}> {{{text}}} ` ); } /** * @mixes module:mobile.startup/View#defaults * @property {Object} defaults Default options hash. * @property {string} defaults.text Section text. */ get defaults() { return { line: undefined, text: '' }; } } module.exports = Section; |