Skip to content

Commit

Permalink
support namespaces that are also functions (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Jul 8, 2017
1 parent 9f8853a commit d95cbdd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
6 changes: 6 additions & 0 deletions templates/default/publish.js
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions templates/default/static/styles/jsdoc-default.css
Expand Up @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions templates/default/tmpl/container.tmpl
Expand Up @@ -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 } ?>
Expand All @@ -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) { ?>
Expand Down
2 changes: 2 additions & 0 deletions templates/default/tmpl/method.tmpl
Expand Up @@ -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>
Expand Down

0 comments on commit d95cbdd

Please sign in to comment.