Handle interfaces in the generate-externs task
This commit is contained in:
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
16
config/jsdoc/info/interface-plugin.js
Normal file
16
config/jsdoc/info/interface-plugin.js
Normal 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;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
@@ -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));
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user