This commit is contained in:
Jeff Williams 2014-08-18 15:51:48 -07:00
parent 4479e69578
commit 482d34cc5e

View File

@ -1,8 +1,16 @@
<?js <?js
var self = this; var self = this;
var isGlobalPage;
docs.forEach(function(doc, i) { docs.forEach(function(doc, i) {
?> ?>
<?js
// we only need to check this once
if (typeof isGlobalPage === 'undefined') {
isGlobalPage = (doc.kind === 'globalobj');
}
?>
<?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?> <?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
<?js= self.partial('mainpage.tmpl', doc) ?> <?js= self.partial('mainpage.tmpl', doc) ?>
<?js } else if (doc.kind === 'source') { ?> <?js } else if (doc.kind === 'source') { ?>
@ -72,7 +80,7 @@
<?js <?js
var classes = self.find({kind: 'class', memberof: doc.longname}); var classes = self.find({kind: 'class', memberof: doc.longname});
if (doc.kind !== 'globalobj' && classes && classes.length) { if (!isGlobalPage && classes && classes.length) {
?> ?>
<h3 class="subsection-title">Classes</h3> <h3 class="subsection-title">Classes</h3>
@ -84,7 +92,7 @@
<?js <?js
var mixins = self.find({kind: 'mixin', memberof: doc.longname}); var mixins = self.find({kind: 'mixin', memberof: doc.longname});
if (doc.kind !== 'globalobj' && mixins && mixins.length) { if (!isGlobalPage && mixins && mixins.length) {
?> ?>
<h3 class="subsection-title">Mixins</h3> <h3 class="subsection-title">Mixins</h3>
@ -96,7 +104,7 @@
<?js <?js
var namespaces = self.find({kind: 'namespace', memberof: doc.longname}); var namespaces = self.find({kind: 'namespace', memberof: doc.longname});
if (doc.kind !== 'globalobj' && namespaces && namespaces.length) { if (!isGlobalPage && namespaces && namespaces.length) {
?> ?>
<h3 class="subsection-title">Namespaces</h3> <h3 class="subsection-title">Namespaces</h3>
@ -107,10 +115,10 @@
<?js } ?> <?js } ?>
<?js <?js
var members = self.find({kind: 'member', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
// symbols that are assigned to module.exports are not globals, even though they're not a memberof anything // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
if (title === 'Global' && members && members.length && members.forEach) { if (isGlobalPage && members && members.length && members.forEach) {
members = members.filter(function(m) { members = members.filter(function(m) {
return m.longname && m.longname.indexOf('module:') !== 0; return m.longname && m.longname.indexOf('module:') !== 0;
}); });
@ -125,7 +133,7 @@
<?js } ?> <?js } ?>
<?js <?js
var methods = self.find({kind: 'function', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
if (methods && methods.length && methods.forEach) { if (methods && methods.length && methods.forEach) {
?> ?>
<h3 class="subsection-title">Methods</h3> <h3 class="subsection-title">Methods</h3>
@ -136,7 +144,7 @@
<?js } ?> <?js } ?>
<?js <?js
var typedefs = self.find({kind: 'typedef', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
if (typedefs && typedefs.length && typedefs.forEach) { if (typedefs && typedefs.length && typedefs.forEach) {
?> ?>
<h3 class="subsection-title">Type Definitions</h3> <h3 class="subsection-title">Type Definitions</h3>
@ -156,7 +164,7 @@
<?js } ?> <?js } ?>
<?js <?js
var events = self.find({kind: 'event', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
if (events && events.length && events.forEach) { if (events && events.length && events.forEach) {
?> ?>
<h3 class="subsection-title">Events</h3> <h3 class="subsection-title">Events</h3>