Distinct unexported and undocumented symbols

This commit is contained in:
ahocevar
2014-03-25 18:23:05 +01:00
parent 026c7149c8
commit d0ac615bef
2 changed files with 17 additions and 5 deletions
+16 -3
View File
@@ -5,6 +5,7 @@
*/ */
var api = []; var api = [];
var unexported = [];
function collectExports(source) { function collectExports(source) {
var i, ii, symbol, property; var i, ii, symbol, property;
@@ -56,7 +57,7 @@ exports.handlers = {
} }
} }
if (api.indexOf(e.doclet.longname) > -1) { if (api.indexOf(e.doclet.longname) > -1) {
// Add params of API symbols to the API // Add params and events of API symbols to the API
var names, name; var names, name;
var params = e.doclet.params; var params = e.doclet.params;
if (params) { if (params) {
@@ -66,12 +67,23 @@ exports.handlers = {
for (j = 0, jj=names.length; j < jj; ++j) { for (j = 0, jj=names.length; j < jj; ++j) {
name = names[j]; name = names[j];
if (api.indexOf(name) === -1) { if (api.indexOf(name) === -1) {
api.push(name); unexported.push(name);
} }
} }
} }
} }
} }
var fires = e.doclet.fires;
var event;
if (fires) {
for (i = 0, ii = fires.length; i < ii; ++i) {
event = fires[i].split(' ').pop();
name = event.replace('event:', '');
if (api.indexOf(name) === -1) {
unexported.push(name);
}
}
}
} }
} }
@@ -82,7 +94,8 @@ function filter(e) {
if (e.doclet) { if (e.doclet) {
var fqn = e.doclet.longname; var fqn = e.doclet.longname;
if (fqn) { if (fqn) {
e.doclet.undocumented = (api.indexOf(fqn) === -1); e.doclet.undocumented = (api.indexOf(fqn) === -1 && unexported.indexOf(fqn) === -1);
e.doclet.unexported = (unexported.indexOf(fqn) !== -1);
// Remove parents that are not part of the API // Remove parents that are not part of the API
var parent; var parent;
var parents = e.doclet.augments; var parents = e.doclet.augments;
+1 -2
View File
@@ -27,8 +27,7 @@
<?js if (doc.kind === 'module' && doc.module) { ?> <?js if (doc.kind === 'module' && doc.module) { ?>
<?js= self.partial('method.tmpl', doc.module) ?> <?js= self.partial('method.tmpl', doc.module) ?>
<?js } ?> <?js } ?>
<?js if (!doc.unexported && doc.kind === 'class') { ?>
<?js if (doc.kind === 'class') { ?>
<?js= self.partial('method.tmpl', doc) ?> <?js= self.partial('method.tmpl', doc) ?>
<?js } else { ?> <?js } else { ?>
<?js if (doc.description) { ?> <?js if (doc.description) { ?>