Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
Added the updates so that the @interface tags can be processed and re… (
Browse files Browse the repository at this point in the history
#3)

* Added the updates so that the @interface tags can be processed and rendered successfully.

* Added the updates so that the @interface tags can be processed and rendered successfully.
  • Loading branch information
Eric Hallander authored and bigtimebuddy committed Jul 21, 2017
1 parent 52b14be commit ae14956
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
static/**/jaguar.*
static/**/jaguar.*
.idea/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jaguarjs-jsdoc",
"version": "1.0.2",
"version": "1.0.3",
"description": "Jaguar.js template for JSDoc 3",
"dependencies": {},
"devDependencies": {
Expand Down
19 changes: 17 additions & 2 deletions publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function needsSignature(doclet) {
needsSig = true;
}
// typedefs that contain functions get a signature, too
else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names &&
else if ((doclet.kind === 'typedef' || doclet.kind === 'interface') && doclet.type && doclet.type.names &&
doclet.type.names.length) {
for (var i = 0, l = doclet.type.names.length; i < l; i++) {
if (doclet.type.names[i].toLowerCase() === 'function') {
Expand Down Expand Up @@ -196,6 +196,7 @@ function attachModuleSymbols(doclets, modules) {
* @param {array<object>} members.modules
* @param {array<object>} members.namespaces
* @param {array<object>} members.tutorials
* @param {array<object>} members.interfaces
* @param {array<object>} members.events
* @return {string} The HTML for the navigation sidebar.
*/
Expand All @@ -220,6 +221,10 @@ function buildNav(members) {
kind: 'typedef',
memberof: v.longname
}),
interfaces: find({
kind: 'interface',
memberof: v.longname
}),
events: find({
kind: 'event',
memberof: v.longname
Expand Down Expand Up @@ -249,6 +254,10 @@ function buildNav(members) {
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
interfaces: find({
kind: 'interface',
memberof: v.longname
}),
events: find({
kind: 'event',
Expand Down Expand Up @@ -477,7 +486,8 @@ exports.publish = function(taffyData, opts, tutorials) {
var namespaces = taffy(members.namespaces);
var mixins = taffy(members.mixins);
var externals = taffy(members.externals);

var interfaces = taffy(members.interfaces);

for (var longname in helper.longnameToUrl) {
if ( hasOwnProp.call(helper.longnameToUrl, longname) ) {
var myClasses = helper.find(classes, {longname: longname});
Expand All @@ -504,6 +514,11 @@ exports.publish = function(taffyData, opts, tutorials) {
if (myExternals.length) {
generate('External: ' + myExternals[0].name, myExternals, helper.longnameToUrl[longname]);
}

var myInterfaces = helper.find(interfaces, {longname: longname});
if (myInterfaces.length) {
generate('Interface: ' + myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]);
}
}
}

Expand Down
20 changes: 20 additions & 0 deletions tmpl/container.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,26 @@
}); ?></dl>
<?js } ?>

<?js
var interfaces = self.find({kind: 'interface', memberof: title === 'Global' ? {isUndefined: true} : doc.longname});
if (interfaces && interfaces.length && interfaces.forEach) {
?>
<h3 class="subsection-title">Interface Definitions</h3>

<dl><?js interfaces.forEach(function(e) {
if (e.signature) {
?>
<?js= self.partial('method.tmpl', e) ?>
<?js
}
else {
?>
<?js= self.partial('members.tmpl', e) ?>
<?js
}
}); ?></dl>
<?js } ?>

<?js
var events = self.find({kind: 'event', memberof: title === 'Global' ? {isUndefined: true} : doc.longname});
if (events && events.length && events.forEach) {
Expand Down
14 changes: 14 additions & 0 deletions tmpl/navigation.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ var self = this;
}
?>
</ul>
<ul class="typedefs itemMembers">
<?js
if (item.interfaces.length) {
?>
<span class="subtitle">Interfaces</span>
<?js
item.interfaces.forEach(function (v) {
?>
<li data-name="<?js= v.longname ?>"><?js= self.linkto(v.longname, v.name) ?></li>
<?js
});
}
?>
</ul>
<ul class="methods itemMembers">
<?js
if (item.methods.length) {
Expand Down

0 comments on commit ae14956

Please sign in to comment.