mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added output for returns and params in the default template.
This commit is contained in:
parent
6d4c1e61c1
commit
ae71115165
@ -171,7 +171,13 @@
|
||||
dictionary.defineTag('param', {
|
||||
mustHaveValue: true,
|
||||
canHaveType: true,
|
||||
canHaveName: true
|
||||
canHaveName: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
if (!doclet.params) { doclet.params = []; }
|
||||
doclet.params.push(tag.value);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
dictionary.defineTag('private', {
|
||||
@ -196,7 +202,12 @@
|
||||
|
||||
dictionary.defineTag('returns', {
|
||||
mustHaveValue: true,
|
||||
canHaveType: true
|
||||
canHaveType: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
doclet.returns = tag.value;
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.synonym('return');
|
||||
|
||||
|
||||
@ -29,15 +29,26 @@
|
||||
return !doclet.undocumented;
|
||||
});
|
||||
|
||||
// add template helpers
|
||||
docSet.doclets.forEach(function(doclet) {
|
||||
doclet['params?'] = doclet.params && doclet.params.length > 0;
|
||||
});
|
||||
|
||||
docSet.sortByLongname();
|
||||
|
||||
var partials = {
|
||||
param: readFile(BASEDIR + 'templates/default/tmpl/param.mustache'),
|
||||
returns: readFile(BASEDIR + 'templates/default/tmpl/returns.mustache')
|
||||
};
|
||||
|
||||
// apply template
|
||||
out = Mustache.to_html(
|
||||
templates.index,
|
||||
{
|
||||
docs: docSet.doclets,
|
||||
summarize: summarize
|
||||
}
|
||||
},
|
||||
partials
|
||||
);
|
||||
|
||||
if (opts.destination === 'console') {
|
||||
|
||||
@ -25,6 +25,11 @@
|
||||
font-size: 110%;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
ol.params {
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@ -39,6 +44,21 @@
|
||||
</dt>
|
||||
{{#description}}<dd>
|
||||
{{#summarize}}{{{description}}}{{/summarize}}
|
||||
<div class="details">
|
||||
{{#params?}}
|
||||
<p>Parameters:</p>
|
||||
<ol class="params">
|
||||
{{#params}} {{>param}} {{/params}}
|
||||
</ol>
|
||||
{{/params?}}
|
||||
|
||||
{{#returns}}
|
||||
<p>Returns:</p>
|
||||
<ol class="params">
|
||||
{{>returns}}
|
||||
</ol>
|
||||
{{/returns}}
|
||||
</div>
|
||||
</dd>{{/description}}
|
||||
{{/docs}}
|
||||
</dl>
|
||||
|
||||
6
templates/default/tmpl/param.mustache
Normal file
6
templates/default/tmpl/param.mustache
Normal file
@ -0,0 +1,6 @@
|
||||
<li>
|
||||
{{#type}}
|
||||
{ {{#names}}<span class="param-type">{{.}}</span> {{/names}} }
|
||||
{{/type}}
|
||||
<span class="param-name">{{name}}</span>
|
||||
</li>
|
||||
6
templates/default/tmpl/returns.mustache
Normal file
6
templates/default/tmpl/returns.mustache
Normal file
@ -0,0 +1,6 @@
|
||||
<li>
|
||||
{{#type}}
|
||||
{ {{#names}}<span class="returns-type">{{.}}</span> {{/names}} }
|
||||
{{/type}}
|
||||
<span class="returns-desc">{{description}}</span>
|
||||
</li>
|
||||
Loading…
x
Reference in New Issue
Block a user