Skip to content

Commit

Permalink
Merge branch 'master' into i18n-toc-groups-main-page
Browse files Browse the repository at this point in the history
  • Loading branch information
zdrawku authored Oct 24, 2019
2 parents 61a7f4d + 62859f0 commit 664f3fa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
18 changes: 18 additions & 0 deletions components/convert-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,23 @@ export class ConvertComponent extends ConverterComponent {
comment[Constants.COMMENT] = Object.assign(this.getParamsComments(reflection), comment[Constants.COMMENT]);
}

if (options[Constants.INCLUDE_TAGS_OPTION] && reflection.comment.returns) {
comment[Constants.COMMENT] = Object.assign(this.getReturnsComment(reflection), comment[Constants.COMMENT]);
}

return comment;
}

/**
* Extract the comment from the @return parameter.
* @param reflection
*/
private getReturnsComment(reflection) {
let returns = {};
returns[Constants.RETURNS] = this.getCommentData(reflection.comment);
return returns;
}

/**
* Returns all parameters per comment.
* @param reflection
Expand Down Expand Up @@ -262,6 +276,10 @@ export class ConvertComponent extends ConverterComponent {
comment[Constants.COMMENT][Constants.TAG_NAME] = obj.tagName;
}

if(obj.returns) {
comment[Constants.COMMENT][Constants.RETURNS] = obj.returns;
}

return comment;
}

Expand Down
5 changes: 5 additions & 0 deletions components/render-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ export class RenderComponenet extends RendererComponent {
reflection.comment.shortText = parsed;
}

if (reflection.comment.returns) {
parsed = this.parser.joinByCharacter(dataObj[Constants.COMMENT][Constants.RETURNS], '\n');
reflection.comment.returns = parsed;
}

if (reflection.comment.tags && dataObj[Constants.COMMENT][Constants.TAGS]) {
reflection.comment.tags.forEach(tag => {
const tagFromJson = dataObj[Constants.COMMENT][Constants.TAGS][tag.tagName];
Expand Down
11 changes: 8 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export class Constants {
* JSON keys
*/
static readonly PARAMS = 'parameters';
static readonly RETURNS = 'returns';
static readonly TAGS = 'tags';
static readonly TAG_NAME = 'tagName';
static readonly COMMENT = 'comment';
Expand Down

0 comments on commit 664f3fa

Please sign in to comment.