Skip to content

Commit

Permalink
add plugin that removes everything except JSDoc comments from source …
Browse files Browse the repository at this point in the history
…files (jsdoc#304)
  • Loading branch information
hegemonic committed Jan 15, 2013
1 parent b214687 commit 5880a7b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions plugins/commentsOnly.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @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 <[email protected]>
*/

exports.handlers = {
beforeParse: function(e) {
// a JSDoc comment looks like: /**[one or more chars]*/
var comments = e.source.match(/\/\*\*[\s\S]+?\*\//g);
e.source = comments.join('\n\n');
console.log('source: ' + e.source);
}
};

0 comments on commit 5880a7b

Please sign in to comment.