Skip to content

Commit

Permalink
support tab-indented comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Mathieson committed Mar 16, 2013
1 parent 1c4032e commit f921f08
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dox.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports.parseComments = function(js, options){
// end comment
} else if (withinMultiline && !withinSingle && '*' == js[i] && '/' == js[i+1]) {
i += 2;
buf = buf.replace(/^ *\* ?/gm, '');
buf = buf.replace(/^[ \t]*\* ?/gm, '');
var comment = exports.parseComment(buf, options);
comment.ignore = ignore;
comments.push(comment);
Expand Down
17 changes: 17 additions & 0 deletions test/dox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ module.exports = {
});
},

'test .parseComments() tags with tabs': function (done) {
fixture('d-tabs.js', function (err, str) {
var comments = dox.parseComments(str)
, first = comments.shift();

first.tags.should.have.length(4);
first.description.full.should.equal('<p>Parse tag type string "{Array|Object}" etc.</p>');
first.description.summary.should.equal('<p>Parse tag type string "{Array|Object}" etc.</p>');
first.description.body.should.equal('');
first.ctx.type.should.equal('method');
first.ctx.receiver.should.equal('exports');
first.ctx.name.should.equal('parseTagTypes');
first.code.should.equal('exports.parseTagTypes = function(str) {\n\t\treturn str\n\t\t\t.replace(/[{}]/g, \'\')\n\t\t\t.split(/ *[|,\\/] */);\n\t};');
done();
});
},

'test .parseComments() prototypes': function (done){
fixture('prototypes.js', function(err, str){
var comments = dox.parseComments(str)
Expand Down

0 comments on commit f921f08

Please sign in to comment.