mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Most of the existing author tags are grossly out of date at this point. The definitive reference for who has contributed what is available at https://github.com/jsdoc3/jsdoc/graphs/contributors.
20 lines
625 B
JavaScript
20 lines
625 B
JavaScript
/**
|
|
* 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
|
|
*/
|
|
'use strict';
|
|
|
|
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');
|
|
} else {
|
|
e.source = ''; // If file has no comments, parser should still receive no code
|
|
}
|
|
}
|
|
};
|