checking in jsdoc dir so people can generate docs themselves

This commit is contained in:
Eric Rowell
2014-01-12 00:39:08 -08:00
parent 98b282b819
commit 8dd503c7bd
376 changed files with 24397 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
/*global app: true */
/**
* Utility functions to support the JSDoc plugin framework.
* @module jsdoc/plugins
*/
var error = require('jsdoc/util/error');
var path = require('jsdoc/path');
exports.installPlugins = function(plugins, p) {
var dictionary = require('jsdoc/tag/dictionary');
var parser = p;
var eventName;
var plugin;
var pluginPath;
for (var i = 0, l = plugins.length; i < l; i++) {
pluginPath = path.getResourcePath(path.dirname(plugins[i]), path.basename(plugins[i]));
if (!pluginPath) {
error.handle(new Error('Unable to find the plugin "' + plugins[i] + '"'));
}
else {
plugin = require(pluginPath);
// allow user-defined plugins to...
//...register event handlers
if (plugin.handlers) {
Object.keys(plugin.handlers).forEach(function(eventName) {
parser.on(eventName, plugin.handlers[eventName]);
});
}
//...define tags
if (plugin.defineTags) {
plugin.defineTags(dictionary);
}
//...add a node visitor
if (plugin.nodeVisitor) {
parser.addNodeVisitor(plugin.nodeVisitor);
}
}
}
};