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