Bring back basic api documentation

This commit is contained in:
ahocevar
2018-05-09 12:01:16 +02:00
parent 701aaedf4d
commit 636369181b
5 changed files with 125 additions and 143 deletions

View File

@@ -24,6 +24,7 @@ exports.defineTags = function(dictionary) {
const api = [];
const classes = {};
const types = {};
const modules = {};
function hasApiMembers(doclet) {
return doclet.longname.split('#')[0] == this.longname;
@@ -68,6 +69,7 @@ function extractTypes(item) {
item.type.names.forEach(function(type) {
const match = type.match(/^(.*<)?([^>]*)>?$/);
if (match) {
modules[match[2]] = true;
types[match[2]] = true;
}
});
@@ -93,6 +95,7 @@ exports.handlers = {
newDoclet: function(e) {
const doclet = e.doclet;
if (doclet.stability) {
modules[doclet.longname.split('~').shift()] = true;
api.push(doclet);
}
// Mark explicity defined namespaces - needed in parseComplete to keep
@@ -101,6 +104,7 @@ exports.handlers = {
doclet.namespace_ = true;
}
if (doclet.kind == 'class') {
modules[doclet.longname.split('~').shift()] = true;
classes[doclet.longname] = doclet;
}
},
@@ -126,6 +130,9 @@ exports.handlers = {
// Always document namespaces and items with stability annotation
continue;
}
if (doclet.kind == 'module' && doclet.longname in modules) {
continue;
}
if (doclet.kind == 'class' && api.some(hasApiMembers, doclet)) {
// Mark undocumented classes with documented members as unexported.
// This is used in ../template/tmpl/container.tmpl to hide the