Comparing version 0.2.1 to 0.3.0
@@ -21,3 +21,3 @@ (function() { | ||
ArgumentListItemRegex = '^\\s*`([\\w\\.-]+)`(\\s*[:-])?\\s*'; | ||
ArgumentListItemRegex = '^\\s*`([\\w\\.-]+)`(\\s*[:-])?(\\s*\\(optional\\))?\\s*'; | ||
@@ -57,4 +57,7 @@ /* | ||
parseSummaryAndDescription = function(tokens) { | ||
parseSummaryAndDescription = function(tokens, tokenCallback) { | ||
var description, rawSummary, rawVisibility, returnValues, summary, visibility, visibilityMatch; | ||
if (tokenCallback == null) { | ||
tokenCallback = stopOnSectionBoundaries; | ||
} | ||
summary = ''; | ||
@@ -82,3 +85,3 @@ description = ''; | ||
summary = rawSummary; | ||
description = generateDescription(tokens, stopOnSectionBoundaries); | ||
description = generateDescription(tokens, tokenCallback); | ||
if (rawVisibility != null) { | ||
@@ -117,3 +120,3 @@ description = description.replace(rawVisibility, ''); | ||
parseEventsSection = function(tokens) { | ||
var args, description, events, firstToken, name, summary, _ref1; | ||
var args, description, events, firstToken, name, stopTokenCallback, summary, visibility, _ref1; | ||
firstToken = _.first(tokens); | ||
@@ -123,17 +126,21 @@ if (!(firstToken && firstToken.type === 'heading' && firstToken.text === 'Events' && firstToken.depth === SpecialHeadingDepth)) { | ||
} | ||
stopTokenCallback = function(token, tokens) { | ||
if (token.type === 'heading' && token.depth === SpecialHeadingDepth + 1) { | ||
return false; | ||
} | ||
return stopOnSectionBoundaries(token, tokens); | ||
}; | ||
events = []; | ||
tokens.shift(); | ||
while (tokens.length) { | ||
generateDescription(tokens, function(token, tokens) { | ||
if (token.type === 'heading' && token.depth === SpecialHeadingDepth + 1) { | ||
return false; | ||
} | ||
return stopOnSectionBoundaries(token, tokens); | ||
}); | ||
generateDescription(tokens, stopTokenCallback); | ||
firstToken = _.first(tokens); | ||
if ((firstToken != null ? firstToken.type : void 0) === 'heading') { | ||
tokens.shift(); | ||
_ref1 = parseSummaryAndDescription(tokens), summary = _ref1.summary, description = _ref1.description; | ||
_ref1 = parseSummaryAndDescription(tokens, stopTokenCallback), summary = _ref1.summary, description = _ref1.description, visibility = _ref1.visibility; | ||
name = firstToken.text; | ||
args = parseArgumentList(tokens); | ||
if (args.length === 0) { | ||
args = null; | ||
} | ||
events.push({ | ||
@@ -143,2 +150,3 @@ name: name, | ||
description: description, | ||
visibility: visibility, | ||
"arguments": args | ||
@@ -286,3 +294,3 @@ }); | ||
parseListItem = function(argumentString) { | ||
var description, name, nameMatches, type; | ||
var description, isOptional, name, nameMatches, type; | ||
name = null; | ||
@@ -295,2 +303,3 @@ type = null; | ||
type = getLinkMatch(description); | ||
isOptional = !!nameMatches[3]; | ||
} | ||
@@ -300,3 +309,4 @@ return { | ||
description: description, | ||
type: type | ||
type: type, | ||
isOptional: isOptional | ||
}; | ||
@@ -303,0 +313,0 @@ }; |
{ | ||
"name": "atomdoc", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A atomdoc parser", | ||
@@ -5,0 +5,0 @@ "main": "./lib/atomdoc.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21411
492