From db5b2e284a559a3838242b9d6066dd203ab761f3 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Sat, 3 May 2014 10:56:26 +0200 Subject: [PATCH] Do not remove classes that other classes inherit from --- apidoc/plugins/api.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/apidoc/plugins/api.js b/apidoc/plugins/api.js index 9aaf34cfda..9a891f6962 100644 --- a/apidoc/plugins/api.js +++ b/apidoc/plugins/api.js @@ -36,7 +36,23 @@ function hasApiMembers(doclet) { return doclet.longname.split('#')[0] == this.longname; } +function includeAugments(doclet) { + var augments = doclet.augments; + if (augments) { + var cls; + for (var i = augments.length - 1; i >= 0; --i) { + cls = classes[augments[i]]; + if (cls) { + cls.hideConstructor = true; + includeAugments(cls); + } + } + } +} + var api = []; +var augments = {}; +var classes = {}; exports.handlers = { @@ -52,14 +68,20 @@ exports.handlers = { if (/.*\.jsdoc$/.test(doclet.meta.filename) && doclet.kind == 'namespace') { doclet.namespace_ = true; } + if (doclet.kind == 'class') { + classes[doclet.longname] = doclet; + } }, parseComplete: function(e) { var doclets = e.doclets; for (var i = doclets.length - 1; i >= 0; --i) { var doclet = doclets[i]; - // Always document namespaces and items with stability annotation if (doclet.stability || doclet.namespace_) { + if (doclet.kind == 'class') { + includeAugments(doclet); + } + // Always document namespaces and items with stability annotation continue; } if (doclet.kind == 'class' && api.some(hasApiMembers, doclet)) { @@ -67,7 +89,8 @@ exports.handlers = { // This is used in ../template/tmpl/container.tmpl to hide the // constructor from the docs. doclet.hideConstructor = true; - } else { + includeAugments(doclet); + } else if (!doclet.hideConstructor) { // Remove all other undocumented symbols doclet.undocumented = true; }