UNPKG

4.48 kBJavaScriptView Raw
1"use strict";
2var __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})();
15var __spreadArrays = (this && this.__spreadArrays) || function () {
16 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
17 for (var r = Array(s), k = 0, i = 0; i < il; i++)
18 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
19 r[k] = a[j];
20 return r;
21};
22Object.defineProperty(exports, "__esModule", { value: true });
23exports.DocInlineTagBase = void 0;
24var DocNode_1 = require("./DocNode");
25var StringChecks_1 = require("../parser/StringChecks");
26var DocExcerpt_1 = require("./DocExcerpt");
27/**
28 * The abstract base class for {@link DocInlineTag}, {@link DocLinkTag}, and {@link DocInheritDocTag}.
29 */
30var DocInlineTagBase = /** @class */ (function (_super) {
31 __extends(DocInlineTagBase, _super);
32 /**
33 * Don't call this directly. Instead use {@link TSDocParser}
34 * @internal
35 */
36 function DocInlineTagBase(parameters) {
37 var _this = _super.call(this, parameters) || this;
38 StringChecks_1.StringChecks.validateTSDocTagName(parameters.tagName);
39 if (DocNode_1.DocNode.isParsedParameters(parameters)) {
40 _this._openingDelimiterExcerpt = new DocExcerpt_1.DocExcerpt({
41 configuration: _this.configuration,
42 excerptKind: DocExcerpt_1.ExcerptKind.InlineTag_OpeningDelimiter,
43 content: parameters.openingDelimiterExcerpt
44 });
45 _this._tagNameExcerpt = new DocExcerpt_1.DocExcerpt({
46 configuration: _this.configuration,
47 excerptKind: DocExcerpt_1.ExcerptKind.InlineTag_TagName,
48 content: parameters.tagNameExcerpt
49 });
50 if (parameters.spacingAfterTagNameExcerpt) {
51 _this._spacingAfterTagNameExcerpt = new DocExcerpt_1.DocExcerpt({
52 configuration: _this.configuration,
53 excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
54 content: parameters.spacingAfterTagNameExcerpt
55 });
56 }
57 _this._closingDelimiterExcerpt = new DocExcerpt_1.DocExcerpt({
58 configuration: _this.configuration,
59 excerptKind: DocExcerpt_1.ExcerptKind.InlineTag_ClosingDelimiter,
60 content: parameters.closingDelimiterExcerpt
61 });
62 }
63 _this._tagName = parameters.tagName;
64 _this._tagNameWithUpperCase = parameters.tagName.toUpperCase();
65 return _this;
66 }
67 Object.defineProperty(DocInlineTagBase.prototype, "tagName", {
68 /**
69 * The TSDoc tag name. TSDoc tag names start with an at-sign (`@`) followed
70 * by ASCII letters using "camelCase" capitalization.
71 *
72 * @remarks
73 * For example, if the inline tag is `{@link Guid.toString | the toString() method}`
74 * then the tag name would be `@link`.
75 */
76 get: function () {
77 return this._tagName;
78 },
79 enumerable: false,
80 configurable: true
81 });
82 Object.defineProperty(DocInlineTagBase.prototype, "tagNameWithUpperCase", {
83 /**
84 * The TSDoc tag name in all capitals, which is used for performing
85 * case-insensitive comparisons or lookups.
86 */
87 get: function () {
88 return this._tagNameWithUpperCase;
89 },
90 enumerable: false,
91 configurable: true
92 });
93 /** @override @sealed */
94 DocInlineTagBase.prototype.onGetChildNodes = function () {
95 return __spreadArrays([
96 this._openingDelimiterExcerpt,
97 this._tagNameExcerpt,
98 this._spacingAfterTagNameExcerpt
99 ], this.getChildNodesForContent(), [
100 this._closingDelimiterExcerpt
101 ]);
102 };
103 return DocInlineTagBase;
104}(DocNode_1.DocNode));
105exports.DocInlineTagBase = DocInlineTagBase;
106//# sourceMappingURL=DocInlineTagBase.js.map
\No newline at end of file