Permalink
Browse files

support tab-indented comments

  • Loading branch information...
1 parent 1c4032e commit f921f0864f65005a31de9e437f4bf46ad6e9e519 @stephenmathieson stephenmathieson committed Mar 16, 2013
Showing with 18 additions and 1 deletion.
  1. +1 −1 lib/dox.js
  2. +17 −0 test/dox.test.js
View
2 lib/dox.js
@@ -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);
View
17 test/dox.test.js
@@ -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)

0 comments on commit f921f08

Please sign in to comment.