Skip to content

Commit

Permalink
fix(app): rawDescription for JSDoc and visitInputAndHostBinding
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed Jul 14, 2021
1 parent f698d96 commit 0bb000d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
24 changes: 1 addition & 23 deletions src/app/compiler/angular-dependencies.ts
Expand Up @@ -756,29 +756,7 @@ export class AngularDependencies extends FrameworkDependencies {
deps.initializer = infos.initializer;
}
if (node.jsDoc && node.jsDoc.length > 0 && node.jsDoc[0].comment) {
const len = node.jsDoc[0].comment.length;
let rawDescription = '';

for (let i = 0; i < len; i++) {
const JSDocNode = node.jsDoc[0].comment[i];
switch (JSDocNode.kind) {
case SyntaxKind.JSDocText:
rawDescription += JSDocNode.text;
break;
case SyntaxKind.JSDocLink:
if (JSDocNode.name) {
rawDescription +=
JSDocNode.text +
'{@link ' +
JSDocNode.name.escapedText +
'}';
}
break;
default:
break;
}
}

const rawDescription = this.jsdocParserUtil.parseJSDocNode(node);
deps.rawdescription = rawDescription;
deps.description = marked(rawDescription);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/compiler/angular/deps/helpers/class-helper.ts
Expand Up @@ -1381,7 +1381,7 @@ export class ClassHelper {
_return.jsdoctags = markedtags(jsdoctags[0].tags);
}
if (typeof property.jsDoc[0].comment !== 'undefined') {
const rawDescription = property.jsDoc[0].comment;
const rawDescription = this.jsdocParserUtil.parseJSDocNode(property);
_return.rawdescription = rawDescription;
_return.description = marked(rawDescription);
}
Expand Down
23 changes: 23 additions & 0 deletions src/utils/jsdoc-parser.util.ts
Expand Up @@ -244,4 +244,27 @@ export class JsdocParserUtil {
return undefined;
}
}

public parseJSDocNode(node): string {
const len = node.jsDoc[0].comment.length;
let rawDescription = '';

for (let i = 0; i < len; i++) {
const JSDocNode = node.jsDoc[0].comment[i];
switch (JSDocNode.kind) {
case SyntaxKind.JSDocText:
rawDescription += JSDocNode.text;
break;
case SyntaxKind.JSDocLink:
if (JSDocNode.name) {
rawDescription +=
JSDocNode.text + '{@link ' + JSDocNode.name.escapedText + '}';
}
break;
default:
break;
}
}
return rawDescription;
}
}

0 comments on commit 0bb000d

Please sign in to comment.