1 | /**
|
2 | * @overview Remove everything in a file except JSDoc-style comments. By enabling this plugin, you
|
3 | * can document source files that are not valid JavaScript (including source files for other
|
4 | * languages).
|
5 | * @module plugins/commentsOnly
|
6 | * @author Jeff Williams <jeffrey.l.williams@gmail.com>
|
7 | */
|
8 | ;
|
9 |
|
10 | exports.handlers = {
|
11 | beforeParse: function(e) {
|
12 | // a JSDoc comment looks like: /**[one or more chars]*/
|
13 | var comments = e.source.match(/\/\*\*[\s\S]+?\*\//g);
|
14 | if (comments) {
|
15 | e.source = comments.join('\n\n');
|
16 | }
|
17 | }
|
18 | };
|