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.DocLinkTag = void 0;
|
17 | var DocNode_1 = require("./DocNode");
|
18 | var DocInlineTagBase_1 = require("./DocInlineTagBase");
|
19 | var DocExcerpt_1 = require("./DocExcerpt");
|
20 |
|
21 |
|
22 |
|
23 | var DocLinkTag = (function (_super) {
|
24 | __extends(DocLinkTag, _super);
|
25 | |
26 |
|
27 |
|
28 |
|
29 | function DocLinkTag(parameters) {
|
30 | var _this = _super.call(this, parameters) || this;
|
31 | if (_this.tagNameWithUpperCase !== '@LINK') {
|
32 | throw new Error('DocLinkTag requires the tag name to be "{@link}"');
|
33 | }
|
34 | _this._codeDestination = parameters.codeDestination;
|
35 | if (DocNode_1.DocNode.isParsedParameters(parameters)) {
|
36 | if (parameters.codeDestination !== undefined && parameters.urlDestinationExcerpt !== undefined) {
|
37 | throw new Error('Either the codeDestination or the urlDestination may be specified, but not both');
|
38 | }
|
39 | if (parameters.urlDestinationExcerpt) {
|
40 | _this._urlDestinationExcerpt = new DocExcerpt_1.DocExcerpt({
|
41 | configuration: _this.configuration,
|
42 | excerptKind: DocExcerpt_1.ExcerptKind.LinkTag_UrlDestination,
|
43 | content: parameters.urlDestinationExcerpt
|
44 | });
|
45 | }
|
46 | if (parameters.spacingAfterDestinationExcerpt) {
|
47 | _this._spacingAfterDestinationExcerpt = new DocExcerpt_1.DocExcerpt({
|
48 | configuration: _this.configuration,
|
49 | excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
|
50 | content: parameters.spacingAfterDestinationExcerpt
|
51 | });
|
52 | }
|
53 | if (parameters.pipeExcerpt) {
|
54 | _this._pipeExcerpt = new DocExcerpt_1.DocExcerpt({
|
55 | configuration: _this.configuration,
|
56 | excerptKind: DocExcerpt_1.ExcerptKind.LinkTag_Pipe,
|
57 | content: parameters.pipeExcerpt
|
58 | });
|
59 | }
|
60 | if (parameters.spacingAfterPipeExcerpt) {
|
61 | _this._spacingAfterPipeExcerpt = new DocExcerpt_1.DocExcerpt({
|
62 | configuration: _this.configuration,
|
63 | excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
|
64 | content: parameters.spacingAfterPipeExcerpt
|
65 | });
|
66 | }
|
67 | if (parameters.linkTextExcerpt) {
|
68 | _this._linkTextExcerpt = new DocExcerpt_1.DocExcerpt({
|
69 | configuration: _this.configuration,
|
70 | excerptKind: DocExcerpt_1.ExcerptKind.LinkTag_LinkText,
|
71 | content: parameters.linkTextExcerpt
|
72 | });
|
73 | }
|
74 | if (parameters.spacingAfterLinkTextExcerpt) {
|
75 | _this._spacingAfterLinkTextExcerpt = new DocExcerpt_1.DocExcerpt({
|
76 | configuration: _this.configuration,
|
77 | excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
|
78 | content: parameters.spacingAfterLinkTextExcerpt
|
79 | });
|
80 | }
|
81 | }
|
82 | else {
|
83 | if (parameters.codeDestination !== undefined && parameters.urlDestination !== undefined) {
|
84 | throw new Error('Either the codeDestination or the urlDestination may be specified, but not both');
|
85 | }
|
86 | _this._urlDestination = parameters.urlDestination;
|
87 | _this._linkText = parameters.linkText;
|
88 | }
|
89 | return _this;
|
90 | }
|
91 | Object.defineProperty(DocLinkTag.prototype, "kind", {
|
92 |
|
93 | get: function () {
|
94 | return DocNode_1.DocNodeKind.LinkTag;
|
95 | },
|
96 | enumerable: false,
|
97 | configurable: true
|
98 | });
|
99 | Object.defineProperty(DocLinkTag.prototype, "codeDestination", {
|
100 | |
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | get: function () {
|
107 | return this._codeDestination;
|
108 | },
|
109 | enumerable: false,
|
110 | configurable: true
|
111 | });
|
112 | Object.defineProperty(DocLinkTag.prototype, "urlDestination", {
|
113 | |
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 | get: function () {
|
120 | if (this._urlDestination === undefined) {
|
121 | if (this._urlDestinationExcerpt !== undefined) {
|
122 | this._urlDestination = this._urlDestinationExcerpt.content.toString();
|
123 | }
|
124 | }
|
125 | return this._urlDestination;
|
126 | },
|
127 | enumerable: false,
|
128 | configurable: true
|
129 | });
|
130 | Object.defineProperty(DocLinkTag.prototype, "linkText", {
|
131 | |
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 | get: function () {
|
154 | if (this._linkText === undefined) {
|
155 | if (this._linkTextExcerpt !== undefined) {
|
156 | this._linkText = this._linkTextExcerpt.content.toString();
|
157 | }
|
158 | }
|
159 | return this._linkText;
|
160 | },
|
161 | enumerable: false,
|
162 | configurable: true
|
163 | });
|
164 |
|
165 | DocLinkTag.prototype.getChildNodesForContent = function () {
|
166 |
|
167 | return [
|
168 | this._codeDestination,
|
169 | this._urlDestinationExcerpt,
|
170 | this._spacingAfterDestinationExcerpt,
|
171 | this._pipeExcerpt,
|
172 | this._spacingAfterPipeExcerpt,
|
173 | this._linkTextExcerpt,
|
174 | this._spacingAfterLinkTextExcerpt
|
175 | ];
|
176 | };
|
177 | return DocLinkTag;
|
178 | }(DocInlineTagBase_1.DocInlineTagBase));
|
179 | exports.DocLinkTag = DocLinkTag;
|
180 |
|
\ | No newline at end of file |