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