Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Mn / erge branch 'master' of github.com:visionmedia/dox

  • Loading branch information...
commit 681a6e66ae6f79c61b5b4776938f81a6edcb4d2d 2 parents 787106d + 4240030
@tj authored
Showing with 33 additions and 5 deletions.
  1. +1 −5 lib/dox.js
  2. +17 −0 test/dox.test.js
  3. +15 −0 test/fixtures/d-tabs.js
View
6 lib/dox.js
@@ -52,7 +52,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);
@@ -291,9 +291,5 @@ exports.parseCodeContext = function(str){
, value: RegExp.$2
, string: RegExp.$1
};
- // result of iffe
- // amaze.lib.indexOf = (function () {
- } else if (/[ \t]*=[ \t]*\(function/.exec(str)) {
-
}
};
View
17 test/dox.test.js
@@ -124,6 +124,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)
View
15 test/fixtures/d-tabs.js
@@ -0,0 +1,15 @@
+
+ /**
+ * Parse tag type string "{Array|Object}" etc.
+ *
+ * @name is arbitrary
+ * @param {String} str
+ * @return {Array}
+ * @api public
+ */
+
+ exports.parseTagTypes = function(str) {
+ return str
+ .replace(/[{}]/g, '')
+ .split(/ *[|,\/] */);
+ };
Please sign in to comment.
Something went wrong with that request. Please try again.