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, DocNode } from './DocNode';
|
15 | import { DocExcerpt, ExcerptKind } from './DocExcerpt';
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | var DocFencedCode = (function (_super) {
|
22 | __extends(DocFencedCode, _super);
|
23 | |
24 |
|
25 |
|
26 |
|
27 | function DocFencedCode(parameters) {
|
28 | var _this = _super.call(this, parameters) || this;
|
29 | if (DocNode.isParsedParameters(parameters)) {
|
30 | _this._openingFenceExcerpt = new DocExcerpt({
|
31 | configuration: _this.configuration,
|
32 | excerptKind: ExcerptKind.FencedCode_OpeningFence,
|
33 | content: parameters.openingFenceExcerpt
|
34 | });
|
35 | if (parameters.spacingAfterOpeningFenceExcerpt) {
|
36 | _this._spacingAfterOpeningFenceExcerpt = new DocExcerpt({
|
37 | configuration: _this.configuration,
|
38 | excerptKind: ExcerptKind.Spacing,
|
39 | content: parameters.spacingAfterOpeningFenceExcerpt
|
40 | });
|
41 | }
|
42 | if (parameters.languageExcerpt) {
|
43 | _this._languageExcerpt = new DocExcerpt({
|
44 | configuration: _this.configuration,
|
45 | excerptKind: ExcerptKind.FencedCode_Language,
|
46 | content: parameters.languageExcerpt
|
47 | });
|
48 | }
|
49 | if (parameters.spacingAfterLanguageExcerpt) {
|
50 | _this._spacingAfterLanguageExcerpt = new DocExcerpt({
|
51 | configuration: _this.configuration,
|
52 | excerptKind: ExcerptKind.Spacing,
|
53 | content: parameters.spacingAfterLanguageExcerpt
|
54 | });
|
55 | }
|
56 | _this._codeExcerpt = new DocExcerpt({
|
57 | configuration: _this.configuration,
|
58 | excerptKind: ExcerptKind.FencedCode_Code,
|
59 | content: parameters.codeExcerpt
|
60 | });
|
61 | if (parameters.spacingBeforeClosingFenceExcerpt) {
|
62 | _this._spacingBeforeClosingFenceExcerpt = new DocExcerpt({
|
63 | configuration: _this.configuration,
|
64 | excerptKind: ExcerptKind.Spacing,
|
65 | content: parameters.spacingBeforeClosingFenceExcerpt
|
66 | });
|
67 | }
|
68 | _this._closingFenceExcerpt = new DocExcerpt({
|
69 | configuration: _this.configuration,
|
70 | excerptKind: ExcerptKind.FencedCode_ClosingFence,
|
71 | content: parameters.closingFenceExcerpt
|
72 | });
|
73 | if (parameters.spacingAfterClosingFenceExcerpt) {
|
74 | _this._spacingAfterClosingFenceExcerpt = new DocExcerpt({
|
75 | configuration: _this.configuration,
|
76 | excerptKind: ExcerptKind.Spacing,
|
77 | content: parameters.spacingAfterClosingFenceExcerpt
|
78 | });
|
79 | }
|
80 | }
|
81 | else {
|
82 | _this._code = parameters.code;
|
83 | _this._language = parameters.language;
|
84 | }
|
85 | return _this;
|
86 | }
|
87 | Object.defineProperty(DocFencedCode.prototype, "kind", {
|
88 |
|
89 | get: function () {
|
90 | return DocNodeKind.FencedCode;
|
91 | },
|
92 | enumerable: false,
|
93 | configurable: true
|
94 | });
|
95 | Object.defineProperty(DocFencedCode.prototype, "language", {
|
96 | |
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | get: function () {
|
112 | if (this._language === undefined) {
|
113 | if (this._languageExcerpt !== undefined) {
|
114 | this._language = this._languageExcerpt.content.toString();
|
115 | }
|
116 | else {
|
117 | this._language = '';
|
118 | }
|
119 | }
|
120 | return this._language;
|
121 | },
|
122 | enumerable: false,
|
123 | configurable: true
|
124 | });
|
125 | Object.defineProperty(DocFencedCode.prototype, "code", {
|
126 | |
127 |
|
128 |
|
129 | get: function () {
|
130 | if (this._code === undefined) {
|
131 | if (this._codeExcerpt !== undefined) {
|
132 | this._code = this._codeExcerpt.content.toString();
|
133 | }
|
134 | }
|
135 | return this._code;
|
136 | },
|
137 | enumerable: false,
|
138 | configurable: true
|
139 | });
|
140 |
|
141 | DocFencedCode.prototype.onGetChildNodes = function () {
|
142 | return [
|
143 | this._openingFenceExcerpt,
|
144 | this._spacingAfterOpeningFenceExcerpt,
|
145 | this._languageExcerpt,
|
146 | this._spacingAfterLanguageExcerpt,
|
147 | this._codeExcerpt,
|
148 | this._spacingBeforeClosingFenceExcerpt,
|
149 | this._closingFenceExcerpt,
|
150 | this._spacingAfterClosingFenceExcerpt
|
151 | ];
|
152 | };
|
153 | return DocFencedCode;
|
154 | }(DocNode));
|
155 | export { DocFencedCode };
|
156 |
|
\ | No newline at end of file |