support namespaces that are also functions (#955)

This commit is contained in:
Jeff Williams 2017-07-07 19:48:08 -07:00
parent 9f8853acff
commit d95cbdd9c9
4 changed files with 16 additions and 7 deletions

View File

@ -66,6 +66,12 @@ function needsSignature(doclet) {
}
}
}
// and namespaces that are functions get a signature (but finding them is a
// bit messy)
else if (doclet.kind === 'namespace' && doclet.meta && doclet.meta.code &&
doclet.meta.code.type && doclet.meta.code.type.match(/[Ff]unction/)) {
needsSig = true;
}
return needsSig;
}

View File

@ -222,8 +222,8 @@ thead tr
th { border-right: 1px solid #aaa; }
tr > th:last-child { border-right: 1px solid #ddd; }
.ancestors { color: #999; }
.ancestors a
.ancestors, .attribs { color: #999; }
.ancestors a, .attribs a
{
color: #999 !important;
text-decoration: none;

View File

@ -21,13 +21,14 @@
<header>
<?js if (!doc.longname || doc.kind !== 'module') { ?>
<h2><?js if (doc.ancestors && doc.ancestors.length) { ?>
<h2><?js if (doc.attribs) { ?><span class="attribs"><?js= doc.attribs ?></span><?js }
if (doc.ancestors && doc.ancestors.length) { ?>
<span class="ancestors"><?js= doc.ancestors.join('') ?></span><?js
}
?><?js= doc.name ?><?js
if (doc.variation) { ?>
<sup class="variation"><?js= doc.variation ?></sup>
<?js } ?></h2>
<sup class="variation"><?js= doc.variation ?></sup><?js }
if (doc.signature) { ?><?js= doc.signature ?><?js } ?></h2>
<?js if (doc.classdesc) { ?>
<div class="class-description"><?js= doc.classdesc ?></div>
<?js } ?>
@ -50,7 +51,7 @@
<?js doc.modules.forEach(function(module) { ?>
<?js= self.partial('method.tmpl', module) ?>
<?js }) ?>
<?js } else if (doc.kind === 'class') { ?>
<?js } else if (doc.kind === 'class' || (doc.kind === 'namespace' && doc.signature)) { ?>
<?js= self.partial('method.tmpl', doc) ?>
<?js } else { ?>
<?js if (doc.description) { ?>

View File

@ -7,8 +7,10 @@ var self = this;
<h2>Constructor</h2>
<?js } ?>
<?js if (data.kind !== 'namespace') { ?>
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + (kind === 'class' ? 'new ' : '') +
name + (data.signature || '') ?></h4>
<?js } ?>
<?js if (data.summary) { ?>
<p class="summary"><?js= summary ?></p>