node-query/node_modules/jsdoc/plugins/commentsOnly.js

19 lines
585 B
JavaScript
Raw Normal View History

2014-10-20 16:56:45 -04:00
/**
* @overview Remove everything in a file except JSDoc-style comments. By enabling this plugin, you
* can document source files that are not valid JavaScript (including source files for other
* languages).
* @module plugins/commentsOnly
* @author Jeff Williams <jeffrey.l.williams@gmail.com>
*/
2014-10-22 10:11:40 -04:00
'use strict';
2014-10-20 16:56:45 -04:00
exports.handlers = {
beforeParse: function(e) {
// a JSDoc comment looks like: /**[one or more chars]*/
var comments = e.source.match(/\/\*\*[\s\S]+?\*\//g);
if (comments) {
e.source = comments.join('\n\n');
}
}
};