Skip to content

Commit

Permalink
fix: function's returns are missing (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-ji-eng committed May 20, 2020
1 parent 60d8724 commit 2b79e8f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
16 changes: 8 additions & 8 deletions static/styles/jsdoc-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ footer {
max-width: 800px;
}

.params, .props {
.params, .returns, .props {
border-spacing: 0;
border: 1px solid #ddd;
border-radius: 3px;
Expand All @@ -518,34 +518,34 @@ footer {
font-size: 100%;
}

.params td, .params th, .props td, .props th {
.params td, .params th,.returns td, .returns th, .props td, .props th {
margin: 0px;
text-align: left;
vertical-align: top;
padding: 10px;
display: table-cell;
}

.params td {
.params td, .returns td {
border-top: 1px solid #eee;
}

.params thead tr, .props thead tr {
.params thead tr, .returns thead tr,.props thead tr {
background-color: #fff;
font-weight: bold;
}

.params .params thead tr, .props .props thead tr {
.params .params thead tr, .returns .returns thead tr, .props .props thead tr {
background-color: #fff;
font-weight: bold;
}

.params td.description>p:first-child, .props td.description>p:first-child {
.params td.description>p:first-child, .returns td.description>p:first-child, .props td.description>p:first-child {
margin-top: 0;
padding-top: 0;
}

.params td.description>p:last-child, .props td.description>p:last-child {
.params td.description>p:last-child, .returns td.description>p:last-child, .props td.description>p:last-child {
margin-bottom: 0;
padding-bottom: 0;
}
Expand Down Expand Up @@ -737,7 +737,7 @@ table tbody td {
/*word-wrap: break-word;*/
}

td table.params, td table.props {
td table.params, td table.returns, td table.props {
border: 0;
}

Expand Down
7 changes: 6 additions & 1 deletion tmpl/method.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
<?js= this.partial('params.tmpl', params) ?>
<?js } ?>

<?js if (data.returns && returns.length) { ?>
<h5>Returns:</h5>
<?js= this.partial('returns.tmpl', returns) ?>
<?js } ?>

<?js= this.partial('details.tmpl', data) ?>

<?js if (data.kind !== 'module' && data.requires && data.requires.length) { ?>
Expand Down Expand Up @@ -112,7 +117,7 @@
exceptions.forEach(function(r) { ?>
<?js= self.partial('exceptions.tmpl', r) ?>
<?js });
}
}
} ?>

<?js if (data.examples && examples.length) { ?>
Expand Down
44 changes: 30 additions & 14 deletions tmpl/returns.tmpl
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
<?js
var data = obj || {};
if (data.description) {
var returns = obj;
?>
<div class="param-desc">
<?js= description ?>
</div>
<?js } ?>

<?js if (data.type && data.type.names) {?>
<dl class="param-type">
<dt>Type</dt>
<dd>
<?js= this.partial('type.tmpl', data.type.names) ?>
</dd>
</dl>
<?js } ?>
<table class="returns">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>

<tbody>
<?js
var self = this;
returns.forEach(item => {
if (!item) { return; }
?>
<tr>
<td class="type">
<?js if (item.type && item.type.names) {?>
<?js= self.partial('type.tmpl', item.type.names) ?>
<?js } ?>
</td>

<td class="description">
<?js= item.description ?>
</td>
</tr>
<?js }
); ?>
</tbody>
</table>

0 comments on commit 2b79e8f

Please sign in to comment.