1 | var __extends = (this && this.__extends) || (function () {
|
2 | var extendStatics = function (d, b) {
|
3 | extendStatics = Object.setPrototypeOf ||
|
4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6 | return extendStatics(d, b);
|
7 | };
|
8 | return function (d, b) {
|
9 | extendStatics(d, b);
|
10 | function __() { this.constructor = d; }
|
11 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12 | };
|
13 | })();
|
14 | import { DocNodeKind } from './DocNode';
|
15 | import { DocParagraph } from './DocParagraph';
|
16 | import { DocNodeContainer } from './DocNodeContainer';
|
17 |
|
18 |
|
19 |
|
20 | var DocSection = (function (_super) {
|
21 | __extends(DocSection, _super);
|
22 | |
23 |
|
24 |
|
25 |
|
26 | function DocSection(parameters, childNodes) {
|
27 | return _super.call(this, parameters, childNodes) || this;
|
28 | }
|
29 | Object.defineProperty(DocSection.prototype, "kind", {
|
30 |
|
31 | get: function () {
|
32 | return DocNodeKind.Section;
|
33 | },
|
34 | enumerable: false,
|
35 | configurable: true
|
36 | });
|
37 | |
38 |
|
39 |
|
40 |
|
41 | DocSection.prototype.appendNodeInParagraph = function (docNode) {
|
42 | var paragraphNode = undefined;
|
43 | if (this.nodes.length > 0) {
|
44 | var lastNode = this.nodes[this.nodes.length - 1];
|
45 | if (lastNode.kind === DocNodeKind.Paragraph) {
|
46 | paragraphNode = lastNode;
|
47 | }
|
48 | }
|
49 | if (!paragraphNode) {
|
50 | paragraphNode = new DocParagraph({ configuration: this.configuration });
|
51 | this.appendNode(paragraphNode);
|
52 | }
|
53 | paragraphNode.appendNode(docNode);
|
54 | };
|
55 | DocSection.prototype.appendNodesInParagraph = function (docNodes) {
|
56 | for (var _i = 0, docNodes_1 = docNodes; _i < docNodes_1.length; _i++) {
|
57 | var docNode = docNodes_1[_i];
|
58 | this.appendNodeInParagraph(docNode);
|
59 | }
|
60 | };
|
61 | return DocSection;
|
62 | }(DocNodeContainer));
|
63 | export { DocSection };
|
64 |
|
\ | No newline at end of file |