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B","sourcesContent":["import { DocNode, DocNodeKind, IDocNodeParameters, IDocNodeParsedParameters } from './DocNode';\r\nimport { TokenSequence } from '../parser/TokenSequence';\r\nimport { DocExcerpt, ExcerptKind } from './DocExcerpt';\r\n\r\n/**\r\n * Constructor parameters for {@link DocHtmlAttribute}.\r\n */\r\nexport interface IDocHtmlAttributeParameters extends IDocNodeParameters {\r\n name: string;\r\n spacingAfterName?: string;\r\n spacingAfterEquals?: string;\r\n value: string;\r\n spacingAfterValue?: string;\r\n}\r\n\r\n/**\r\n * Constructor parameters for {@link DocHtmlAttribute}.\r\n */\r\nexport interface IDocHtmlAttributeParsedParameters extends IDocNodeParsedParameters {\r\n nameExcerpt: TokenSequence;\r\n spacingAfterNameExcerpt?: TokenSequence;\r\n\r\n equalsExcerpt: TokenSequence;\r\n spacingAfterEqualsExcerpt?: TokenSequence;\r\n\r\n valueExcerpt: TokenSequence;\r\n spacingAfterValueExcerpt?: TokenSequence;\r\n}\r\n\r\n/**\r\n * Represents an HTML attribute inside a DocHtmlStartTag or DocHtmlEndTag.\r\n *\r\n * Example: `href=\"#\"` inside `<a href=\"#\" />`\r\n */\r\nexport class DocHtmlAttribute extends DocNode {\r\n // The attribute name\r\n private _name: string | undefined;\r\n private readonly _nameExcerpt: DocExcerpt | undefined;\r\n\r\n private _spacingAfterName: string | undefined;\r\n private readonly _spacingAfterNameExcerpt: DocExcerpt | undefined;\r\n\r\n // The \"=\" delimiter\r\n private readonly _equalsExcerpt: DocExcerpt | undefined;\r\n\r\n private _spacingAfterEquals: string | undefined;\r\n private readonly _spacingAfterEqualsExcerpt: DocExcerpt | undefined;\r\n\r\n // The attribute value including quotation marks\r\n private _value: string | undefined;\r\n private readonly _valueExcerpt: DocExcerpt | undefined;\r\n\r\n private _spacingAfterValue: string | undefined;\r\n private readonly _spacingAfterValueExcerpt: DocExcerpt | undefined;\r\n\r\n /**\r\n * Don't call this directly. Instead use {@link TSDocParser}\r\n * @internal\r\n */\r\n public constructor(parameters: IDocHtmlAttributeParameters | IDocHtmlAttributeParsedParameters) {\r\n super(parameters);\r\n\r\n if (DocNode.isParsedParameters(parameters)) {\r\n this._nameExcerpt = new DocExcerpt({\r\n configuration: this.configuration,\r\n excerptKind: ExcerptKind.HtmlAttribute_Name,\r\n content: parameters.nameExcerpt\r\n });\r\n if (parameters.spacingAfterNameExcerpt) {\r\n this._spacingAfterNameExcerpt = new DocExcerpt({\r\n configuration: this.configuration,\r\n excerptKind: ExcerptKind.Spacing,\r\n content: parameters.spacingAfterNameExcerpt\r\n });\r\n }\r\n\r\n this._equalsExcerpt = new DocExcerpt({\r\n configuration: this.configuration,\r\n excerptKind: ExcerptKind.HtmlAttribute_Equals,\r\n content: parameters.equalsExcerpt\r\n });\r\n if (parameters.spacingAfterEqualsExcerpt) {\r\n this._spacingAfterEqualsExcerpt = new DocExcerpt({\r\n configuration: this.configuration,\r\n excerptKind: ExcerptKind.Spacing,\r\n content: parameters.spacingAfterEqualsExcerpt\r\n });\r\n }\r\n\r\n this._valueExcerpt = new DocExcerpt({\r\n configuration: this.configuration,\r\n excerptKind: ExcerptKind.HtmlAttribute_Value,\r\n content: parameters.valueExcerpt\r\n });\r\n if (parameters.spacingAfterValueExcerpt) {\r\n this._spacingAfterValueExcerpt = new DocExcerpt({\r\n configuration: this.configuration,\r\n excerptKind: ExcerptKind.Spacing,\r\n content: parameters.spacingAfterValueExcerpt\r\n });\r\n }\r\n } else {\r\n this._name = parameters.name;\r\n this._spacingAfterName = parameters.spacingAfterName;\r\n\r\n this._spacingAfterEquals = parameters.spacingAfterEquals;\r\n\r\n this._value = parameters.value;\r\n this._spacingAfterValue = parameters.spacingAfterValue;\r\n }\r\n }\r\n\r\n /** @override */\r\n public get kind(): DocNodeKind | string {\r\n return DocNodeKind.HtmlAttribute;\r\n }\r\n\r\n /**\r\n * The HTML attribute name.\r\n */\r\n public get name(): string {\r\n if (this._name === undefined) {\r\n this._name = this._nameExcerpt!.content.toString();\r\n }\r\n return this._name;\r\n }\r\n\r\n /**\r\n * Explicit whitespace that a renderer should insert after the HTML attribute name.\r\n * If undefined, then the renderer can use a formatting rule to generate appropriate spacing.\r\n */\r\n public get spacingAfterName(): string | undefined {\r\n if (this._spacingAfterName === undefined) {\r\n if (this._spacingAfterNameExcerpt !== undefined) {\r\n this._spacingAfterName = this._spacingAfterNameExcerpt.content.toString();\r\n }\r\n }\r\n return this._spacingAfterName;\r\n }\r\n\r\n /**\r\n * Explicit whitespace that a renderer should insert after the \"=\".\r\n * If undefined, then the renderer can use a formatting rule to generate appropriate spacing.\r\n */\r\n public get spacingAfterEquals(): string | undefined {\r\n if (this._spacingAfterEquals === undefined) {\r\n if (this._spacingAfterEqualsExcerpt !== undefined) {\r\n this._spacingAfterEquals = this._spacingAfterEqualsExcerpt.content.toString();\r\n }\r\n }\r\n return this._spacingAfterEquals;\r\n }\r\n\r\n /**\r\n * The HTML attribute value.\r\n */\r\n public get value(): string {\r\n if (this._value === undefined) {\r\n this._value = this._valueExcerpt!.content.toString();\r\n }\r\n return this._value;\r\n }\r\n\r\n /**\r\n * Explicit whitespace that a renderer should insert after the HTML attribute name.\r\n * If undefined, then the renderer can use a formatting rule to generate appropriate spacing.\r\n */\r\n public get spacingAfterValue(): string | undefined {\r\n if (this._spacingAfterValue === undefined) {\r\n if (this._spacingAfterValueExcerpt !== undefined) {\r\n this._spacingAfterValue = this._spacingAfterValueExcerpt.content.toString();\r\n }\r\n }\r\n return this._spacingAfterValue;\r\n }\r\n\r\n /** @override */\r\n protected onGetChildNodes(): ReadonlyArray<DocNode | undefined> {\r\n return [\r\n this._nameExcerpt,\r\n this._spacingAfterNameExcerpt,\r\n this._equalsExcerpt,\r\n this._spacingAfterEqualsExcerpt,\r\n this._valueExcerpt,\r\n this._spacingAfterValueExcerpt\r\n ];\r\n }\r\n}\r\n"]} |