Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #80 from timoxley/bug/api-code-blocks

Prevent error when using --api & comments have no example code.
  • Loading branch information...
commit fbd74c2e35918b3f1ba7045608f06df5e84ab09d 2 parents 1752888 + c9c8087
@tj authored
Showing with 10 additions and 2 deletions.
  1. +1 −1  lib/api.js
  2. +9 −1 test/dox.test.js
View
2  lib/api.js
@@ -20,7 +20,7 @@ module.exports = function(comments){
.join('\n')
.replace(/^ *#/gm, '')
- var code = buf.match(/^( {4}[^\n]+\n*)+/gm);
+ var code = buf.match(/^( {4}[^\n]+\n*)+/gm) || [];
code.forEach(function(block){
var code = block.replace(/^ {4}/gm, '');
View
10 test/dox.test.js
@@ -311,4 +311,12 @@ module.exports = {
done();
});
},
-};
+ 'test .api() without inline code in comments': function(done) {
+ fixture('a.js', function(err, str){
+ var comments = dox.parseComments(str);
+ var apiDocs = dox.api(comments);
+ apiDocs.should.equal(" - [exports.version](#exportsversion)\n\n## exports.version\n\n <p>Library version.</p>\n");
+ done();
+ });
+ }
+};
Please sign in to comment.
Something went wrong with that request. Please try again.