Skip to content

Commit

Permalink
Merge pull request #46 from Lokua/skip-single-star
Browse files Browse the repository at this point in the history
added options.dox.skipSingleStar:true, added/updated tests
  • Loading branch information
cbou committed Jan 7, 2016
2 parents 51b6c6d + 2cc6608 commit 8777429
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/markdox.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ exports.parse = function(filepath, options, callback) {
});

options.dox = u.defaults(options.dox || {}, {
raw: true
raw: true,
skipSingleStar: true
});

fs.readFile(filepath, options.encoding, function(err, data){
Expand Down
26 changes: 26 additions & 0 deletions test/comment-types-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var assert = require('assert');
var should = require('should');
var markdox = require('../index');

describe('Markdox', function() {

it('should only parse valid jsdocs (coffee)', function(done) {
var file = __dirname + '/fixtures/comment-types.coffee';
markdox.process(file, function(err, output){
should.not.exist(err);
output.should.not.match(/nope/);
output.should.match(/yep/);
done();
});
});

it('should only parse valid jsdocs (js)', function(done) {
var file = __dirname + '/fixtures/comment-types.js';
markdox.process(file, function(err, output){
should.not.exist(err);
output.should.not.match(/nope/);
output.should.match(/yep/);
done();
});
});
});
17 changes: 17 additions & 0 deletions test/fixtures/comment-types.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
###!
* nope
###

###
* nope
###

### nope ###

# nope

###*
* yep
###

###* yep ###
17 changes: 17 additions & 0 deletions test/fixtures/comment-types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!
* nope
*/

/*
* nope
*/

/* nope */

// nope

/**
* yep
*/

/** yep */
6 changes: 3 additions & 3 deletions test/fixtures/transformTitle.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
###
###*
* h1 My first title
###

###
###*
* This method log a given message to the console.
*
* h2 My second title
Expand All @@ -11,4 +11,4 @@
* @method
###
helloworld = () ->
console.log('hello world!');
console.log('hello world!');

0 comments on commit 8777429

Please sign in to comment.