1 | /* eslint-disable spaced-comment */
|
2 | /**
|
3 | * Demonstrate how to modify the source code before the parser sees it.
|
4 | *
|
5 | * @module plugins/commentConvert
|
6 | */
|
7 | ;
|
8 |
|
9 | exports.handlers = {
|
10 | ///
|
11 | /// Convert ///-style comments into jsdoc comments.
|
12 | /// @param e
|
13 | /// @param e.filename
|
14 | /// @param e.source
|
15 | ///
|
16 | beforeParse: function(e) {
|
17 | e.source = e.source.replace(/(\n[ \t]*\/\/\/[^\n]*)+/g, function($) {
|
18 | var replacement = '\n/**' + $.replace(/^[ \t]*\/\/\//mg, '').replace(/(\n$|$)/, '*/$1');
|
19 |
|
20 | return replacement;
|
21 | });
|
22 | }
|
23 | };
|