diff --git a/config/jsdoc/api/plugins/api.js b/config/jsdoc/api/plugins/api.js index a3fa37f445..c75faef8a2 100644 --- a/config/jsdoc/api/plugins/api.js +++ b/config/jsdoc/api/plugins/api.js @@ -11,6 +11,7 @@ exports.defineTags = function(dictionary) { canHaveType: false, canHaveName: false, onTagged: function(doclet, tag) { + includeTypes(doclet); var level = tag.text || "experimental"; if (levels.indexOf(level) >= 0) { doclet.stability = level; @@ -25,11 +26,15 @@ exports.defineTags = function(dictionary) { /* - * Based on @stability annotations, and assuming that items with no @stability - * annotation should not be documented, this plugin removes undocumented symbols + * Based on @api annotations, and assuming that items with no @api annotation + * should not be documented, this plugin removes undocumented symbols * from the documentation. */ +var api = []; +var classes = {}; +var types = {}; + function hasApiMembers(doclet) { return doclet.longname.split('#')[0] == this.longname; } @@ -71,8 +76,28 @@ function includeAugments(doclet) { } } -var api = []; -var classes = {}; +function extractTypes(item) { + item.type.names.forEach(function(type) { + types[type] = true; + //TODO handle Array. etc. + }); +} + +function includeTypes(doclet) { + if (doclet.params && doclet.kind != 'class') { + doclet.params.forEach(extractTypes); + } + if (doclet.returns) { + doclet.returns.forEach(extractTypes); + } + if (doclet.isEnum) { + types[doclet.meta.code.name] = true; + } + if (doclet.type && doclet.meta.code.type == 'MemberExpression') { + // types in olx.js + extractTypes(doclet); + } +} exports.handlers = { @@ -120,7 +145,7 @@ exports.handlers = { // constructor from the docs. doclet._hideConstructor = true; includeAugments(doclet); - } else if (!doclet._hideConstructor) { + } else if (!doclet._hideConstructor && !(doclet.kind == 'typedef' && doclet.longname in types)) { // Remove all other undocumented symbols doclet.undocumented = true; } diff --git a/config/jsdoc/api/template/tmpl/navigation.tmpl b/config/jsdoc/api/template/tmpl/navigation.tmpl index e5fb726d14..2fe64ace28 100644 --- a/config/jsdoc/api/template/tmpl/navigation.tmpl +++ b/config/jsdoc/api/template/tmpl/navigation.tmpl @@ -39,7 +39,7 @@ var self = this; -
  • +
  • -
  • +
  • -
  • +
  • - + diff --git a/config/jsdoc/api/template/tmpl/stability.tmpl b/config/jsdoc/api/template/tmpl/stability.tmpl index b169bbef46..12037661e3 100644 --- a/config/jsdoc/api/template/tmpl/stability.tmpl +++ b/config/jsdoc/api/template/tmpl/stability.tmpl @@ -2,6 +2,6 @@ var data = obj; var self = this; -if (data.stability != 'stable') { ?> +if (data.stability && data.stability != 'stable') { ?> diff --git a/config/jsdoc/api/template/tmpl/tutorial.tmpl b/config/jsdoc/api/template/tmpl/tutorial.tmpl index b0c79c1dd7..88a0ad52aa 100644 --- a/config/jsdoc/api/template/tmpl/tutorial.tmpl +++ b/config/jsdoc/api/template/tmpl/tutorial.tmpl @@ -1,5 +1,5 @@
    - +
    0) { ?>

      -
    +
    -
    +