Skip to content

Commit

Permalink
fix: propertly emit spacing after tag name, and attributes for self c…
Browse files Browse the repository at this point in the history
…losing tags
  • Loading branch information
suneettipirneni committed Aug 4, 2022
1 parent 8bca007 commit 647e7a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tsdoc/src/emitters/TSDocEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ export class TSDocEmitter {
this._writeContent(docXmlElement.name);
this._writeContent(docXmlElement.spacingAfterName);

// Check if it's self-closing
if (docXmlElement.selfClosingTag) {
this._writeContent('/>');
break;
}

for (const attribute of docXmlElement.xmlAttributes) {
this._writeContent(attribute.name);
this._writeContent(attribute.spacingAfterName);
Expand All @@ -200,6 +194,12 @@ export class TSDocEmitter {
this._writeContent(attribute.spacingAfterValue);
}

// Check if it's self-closing
if (docXmlElement.selfClosingTag) {
this._writeContent('/>');
break;
}

this._writeContent('>');

this._writeContent(docXmlElement.spacingBetweenStartTagAndChildren);
Expand Down
1 change: 1 addition & 0 deletions tsdoc/src/parser/NodeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ export class NodeParser {
parsed: true,
configuration: this._configuration,
nameExcerpt: startTagNameExcerpt,
spacingAfterNameExcerpt: spacingAfterStartTagNameExcerpt,
spacingAfterStartTagNameExcerpt,
startTagOpeningDelimiterExcerpt,
startTagClosingDelimiterExcerpt,
Expand Down

0 comments on commit 647e7a4

Please sign in to comment.