jsdoc: Change the way the package-classes list is rendered by using nested <ul> tags, and have Global Scope appear outside of a nested list.

This commit is contained in:
Jürg Lehni 2011-06-08 15:52:32 +01:00
parent 39380b4c87
commit 75da343022
3 changed files with 17 additions and 12 deletions
build/jsdoc-toolkit/templates/jsdoc

View file

@ -1,5 +1,5 @@
var classLayout = { var classLayout = {
'Paper.js': ['Global Scope:_global_'], '_global_': ['Global Scope:_global_'],
'Basic Types': ['Point', 'Size', 'Rectangle', 'Matrix'], 'Basic Types': ['Point', 'Size', 'Rectangle', 'Matrix'],
'Items': ['Item', 'Layer', 'Group', 'Raster', 'PlacedSymbol'], 'Items': ['Item', 'Layer', 'Group', 'Raster', 'PlacedSymbol'],
'Paths': ['Path', 'CompoundPath', 'Segment', 'Curve', 'PathStyle', 'ruler', 'Paths': ['Path', 'CompoundPath', 'Segment', 'Curve', 'PathStyle', 'ruler',

View file

@ -331,6 +331,8 @@ var Render = new function() {
classes: function() { classes: function() {
// TODO: Use a template instead? // TODO: Use a template instead?
var renderMode = publish.conf.renderMode; var renderMode = publish.conf.renderMode;
var out = '<ul class="package-classes">';
load(JSDOC.opt.t + 'classLayout.js'); load(JSDOC.opt.t + 'classLayout.js');
function parseClassNames(classNames) { function parseClassNames(classNames) {
var out = ''; var out = '';
@ -347,6 +349,7 @@ var Render = new function() {
} }
return out; return out;
} }
function getLink(name) { function getLink(name) {
var link = name; var link = name;
if (name.indexOf(':') > 0) { if (name.indexOf(':') > 0) {
@ -364,16 +367,22 @@ var Render = new function() {
function getHeading(title) { function getHeading(title) {
return '<li><h3>' + title + '</h3></li>\n'; return '<li><h3>' + title + '</h3></li>\n';
} }
var first = true,
out = '<ul class="package-classes">'; var first = true;
for (var i in classLayout) { for (var i in classLayout) {
out += '<li' + (first ? ' class="first">' : '>'); if (i != '_global_') {
out += '<h2>' + i + '</h2></li>\n'; out += '<li' + (first ? ' class="first">' : '>\n');
out += '<h2>' + i + '</h2>\n';
out += '<ul>\n';
}
out += parseClassNames(classLayout[i]); out += parseClassNames(classLayout[i]);
if (i != '_global_') {
out += '</ul>\n';
}
first = false; first = false;
} }
out += '</ul>';
return out; return out + '</ul>';
}, },
index: function(html) { index: function(html) {
return templates.index.process(html); return templates.index.process(html);

View file

@ -114,14 +114,10 @@ ul.package-classes {
padding-bottom: 4px; padding-bottom: 4px;
} }
.package-classes li { .package-classes ul {
margin-left: 10px; margin-left: 10px;
} }
.package-classes li h2 {
margin-left: -10px;
}
.reference h2 a { .reference h2 a {
font-weight: bold; font-weight: bold;
} }