Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally override the default comment regex #8

Merged
merged 9 commits into from
Oct 17, 2014

Conversation

joshwnj
Copy link
Contributor

@joshwnj joshwnj commented Oct 17, 2014

Hi, what do you think about this? I'd like to be able to support different types of comments (eg. // instead of ///). Everything should still be backwards compatible until you opt-in to the custom format.

@FWeinb
Copy link
Owner

FWeinb commented Oct 17, 2014

This sounds dangerous as hell. The regular expression has to return the same match array as the default on to work correctly.

How about adding an option to specifiy the line comment instead of overwriting the whole regex? So say like lineCommentStyle: '//>' and use that in the regex.

@joshwnj
Copy link
Contributor Author

joshwnj commented Oct 17, 2014

@FWeinb that is a fair call :) I've updated so you only set lineCommentStyle or blockCommentStyle rather than overriding the entire regexp. Take a look and let me know if you think it's ready now.

@@ -62,7 +83,7 @@ var CommentExtractor = (function () {

var cleanLineComments = function (comment) {
var type;
var lines = comment.split(/[\/]{3,}/);
var lines = comment.split(/[\/]{2,}/);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be equal to the string passed as the lineCommentStyle

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - thanks for the tip :) I've updated to use the lineCommentStyle.

@FWeinb
Copy link
Owner

FWeinb commented Oct 17, 2014

This is awesome! Really appreciate your work here, add yourself to the contributors in the package.json.

@joshwnj
Copy link
Contributor Author

joshwnj commented Oct 17, 2014

Thanks!

@FWeinb
Copy link
Owner

FWeinb commented Oct 17, 2014

Great work! Will merge

FWeinb added a commit that referenced this pull request Oct 17, 2014
Optionally override the default comment regex
@FWeinb FWeinb merged commit ccea8bc into FWeinb:master Oct 17, 2014
@FWeinb
Copy link
Owner

FWeinb commented Oct 17, 2014

Released in cdocparser@0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants