Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Modify parser to use first match even if in higher positions. #75

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ Parser.prototype._findBlocks = function() {
var regexForFile = this.languages[self.extension] || this.languages['default'];
var matches = regexForFile.docBlocksRegExp.exec(src);
while (matches) {
var block = matches[2] || matches[1];
matches.shift(); // Drop the 0th element which is the full string
var block = _.compact(matches)[0]; // Drop nulls and use first actual match

// Reverse Unicode Linebreaks
block = block.replace(/\uffff/g, '\n');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apidoc-core",
"version": "0.8.3",
"version": "0.8.4",
"description": "Core parser library to generate apidoc result following the apidoc-spec",
"author": "Peter Rottmann <[email protected]>",
"license": "MIT",
Expand Down