Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed annoying title bug

  • Loading branch information...
commit 81d0ca418549e47a94d17f05f90cd063086c4ae0 1 parent 34f9120
@tj authored
Showing with 25 additions and 1 deletion.
  1. +1 −1  lib/dox.js
  2. +10 −0 test/dox.test.js
  3. +14 −0 test/fixtures/titles.js
View
2  lib/dox.js
@@ -101,7 +101,7 @@ exports.parseComment = function(str, options) {
, description = {};
// parse comment body
- description.full = str.split('\n@')[0].replace(/^([\w ]+):$/gm, '## $1');
+ description.full = str.split('\n@')[0].replace(/^([A-Z][\w ]+):$/gm, '## $1');
description.summary = description.full.split('\n\n')[0];
description.body = description.full.split('\n\n').slice(1).join('\n\n');
comment.description = description;
View
10 test/dox.test.js
@@ -147,6 +147,16 @@ module.exports = {
});
},
+ 'test .parseComments() titles': function(done){
+ fixture('titles.js', function(err, str){
+ var comments = dox.parseComments(str);
+ comments[0].description.body.should.include('<h2>Some examples</h2>');
+ comments[0].description.body.should.not.include('<h2>for example</h2>');
+ comments[0].description.body.should.include('<p>Some longer thing<br />for example:</p>');
+ done();
+ });
+ },
+
'test .parseCodeContext() function statement': function(){
var ctx = dox.parseCodeContext('function foo(){\n\n}');
ctx.type.should.equal('function');
View
14 test/fixtures/titles.js
@@ -0,0 +1,14 @@
+
+/**
+ * Description.
+ *
+ * Some examples:
+ *
+ * foo
+ *
+ * Some longer thing
+ * for example:
+ *
+ * bar
+ *
+ */
Please sign in to comment.
Something went wrong with that request. Please try again.