Handle interfaces in the generate-externs task

This commit is contained in:
Andreas Hocevar
2014-08-27 16:13:12 +02:00
parent 4e8abb62f9
commit e560f529c6
4 changed files with 31 additions and 10 deletions

View File

@@ -11,6 +11,7 @@
},
"plugins": [
"config/jsdoc/info/api-plugin",
"config/jsdoc/info/define-plugin"
"config/jsdoc/info/define-plugin",
"config/jsdoc/info/interface-plugin"
]
}

View File

@@ -0,0 +1,16 @@
/**
* Handle the interface annotation.
* @param {Object} dictionary The tag dictionary.
*/
exports.defineTags = function(dictionary) {
var classTag = dictionary.lookUp('class');
dictionary.defineTag('interface', {
mustHaveValue: false,
onTagged: function(doclet, tag) {
classTag.onTagged.apply(this, arguments);
doclet.interface = true;
}
});
};

View File

@@ -28,6 +28,7 @@ exports.publish = function(data, opts) {
[
{define: {isObject: true}},
{api: {isString: true}},
{'interface': {is: true}},
function() {
return this.meta && (/[\\\/]externs$/).test(this.meta.path);
}
@@ -40,6 +41,7 @@ exports.publish = function(data, opts) {
var defines = [];
var typedefs = [];
var externs = [];
var interfaces = [];
docs.filter(function(doc) {
var include = true;
var constructor = doc.memberof;
@@ -118,7 +120,7 @@ exports.publish = function(data, opts) {
return true;
});
}
var target = isExterns ? externs : symbols;
var target = isExterns ? externs : (doc.interface ? interfaces : symbols);
target.push(symbol);
}
});
@@ -128,7 +130,8 @@ exports.publish = function(data, opts) {
symbols: symbols,
defines: defines,
typedefs: typedefs,
externs: externs
externs: externs,
interfaces: interfaces
}, null, 2));
};