mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added ancestry links. Namespaces are now shown in the nav.
This commit is contained in:
parent
71fc8b4e3c
commit
96b0cce002
@ -51,6 +51,18 @@
|
||||
f.signature = (f.signature || '') + '('+pnames.join(', ')+')';
|
||||
}
|
||||
|
||||
function generateAncestry(doc) {
|
||||
var ancestors = [];
|
||||
|
||||
while (doc = doc.memberof) {
|
||||
doc = data.get( data.find({longname: doc}) );
|
||||
if (doc) { doc = doc[0]; }
|
||||
if (!doc) break;
|
||||
ancestors.unshift( linkto(doc.longname, doc.name) );
|
||||
}
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
function addSignatureReturns(f) {
|
||||
var returnTypes = [];
|
||||
|
||||
@ -187,9 +199,12 @@
|
||||
longnameToUrl[longname] = url;
|
||||
});
|
||||
|
||||
// do this after the urls have all been generated
|
||||
data.forEach(function(doclet) {
|
||||
if (doclet.classdesc) doclet.classdesc = renderLinks(doclet.classdesc);
|
||||
if (doclet.description) doclet.description = renderLinks(doclet.description);
|
||||
|
||||
doclet.ancestors = generateAncestry(doclet);
|
||||
});
|
||||
|
||||
var nav = '',
|
||||
@ -203,7 +218,17 @@
|
||||
seen[m.longname] = true;
|
||||
});
|
||||
|
||||
nav = nav + '</ul>';
|
||||
nav = nav + '</ul>';
|
||||
}
|
||||
var namespaceNames = data.get( data.find({kind: 'namespace'}) );
|
||||
if (namespaceNames.length) {
|
||||
nav = nav + '<h3>Namespaces</h3><ul>';
|
||||
namespaceNames.forEach(function(n) {
|
||||
if (!seen[n.longname]) nav += '<li>'+linkto(n.longname, n.name)+'</li>';
|
||||
seen[n.longname] = true;
|
||||
});
|
||||
|
||||
nav = nav + '</ul>';
|
||||
}
|
||||
var classNames = data.get( data.find({kind: 'class'}) );
|
||||
if (classNames.length) {
|
||||
@ -213,7 +238,7 @@
|
||||
seen[c.longname] = true;
|
||||
});
|
||||
|
||||
nav = nav + '</ul>';
|
||||
nav = nav + '</ul>';
|
||||
}
|
||||
|
||||
for (var longname in longnameToUrl) {
|
||||
|
||||
@ -26,10 +26,22 @@
|
||||
|
||||
<header>
|
||||
<?js
|
||||
if (doc.variation) {
|
||||
print('<h2 id="'+doc.variation+'" class="variation">'+doc.name+'<sup>'+doc.variation+'</sup></h2>');
|
||||
print('<h2>');
|
||||
|
||||
if (doc.ancestors && doc.ancestors.length) {
|
||||
print('<span class="ancestors">'+doc.ancestors.join(' » ')+'</span>');
|
||||
print(' » '+doc.name);
|
||||
}
|
||||
else {
|
||||
print(doc.name)
|
||||
}
|
||||
|
||||
if (doc.variation) {
|
||||
print('<sup>'+doc.variation+'</sup>');
|
||||
}
|
||||
|
||||
print('</h2>');
|
||||
|
||||
if (doc.classdesc) {
|
||||
print('<p class="class-description">'+doc.classdesc+'</p>');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user