atomdoc
Advanced tools
Comparing version 1.0.2 to 1.0.3
(function() { | ||
var ArgumentListItemRegex, Doc, ReturnsRegex, SpecialHeadingDepth, SpecialHeadings, VisibilityRegex, generateBlockquote, generateCode, generateDescription, generateHeading, generateList, generateParagraph, getLinkMatch, isArgumentListItem, isReturnValue, marked, multiplyString, parse, parseArgumentList, parseArgumentsSection, parseEventsSection, parseExamplesSection, parseListItem, parseReturnValues, parseSummaryAndDescription, stopOnSectionBoundaries, _, _ref, | ||
var ArgumentListItemRegex, Doc, ReturnsRegex, SpecialHeadingDepth, SpecialHeadings, VisibilityRegex, generateBlockquote, generateCode, generateDescription, generateHeading, generateList, generateParagraph, getLinkMatch, isArgumentListItem, isAtArgumentList, isReturnValue, marked, multiplyString, parse, parseArgumentList, parseArgumentsSection, parseEventsSection, parseExamplesSection, parseListItem, parseReturnValues, parseSummaryAndDescription, stopOnSectionBoundaries, _, _ref, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -31,3 +31,3 @@ | ||
parse = function(docString) { | ||
var args, doc, events, examples, firstToken, lexer, returnValues, tokens; | ||
var args, doc, events, examples, extraDescription, firstToken, lexer, returnValues, tokens; | ||
lexer = new marked.Lexer(); | ||
@@ -51,3 +51,4 @@ tokens = lexer.lex(docString); | ||
} else { | ||
tokens.shift(); | ||
extraDescription = generateDescription(tokens, stopOnSectionBoundaries); | ||
doc.description += "\n\n" + extraDescription; | ||
} | ||
@@ -98,8 +99,12 @@ } | ||
parseArgumentsSection = function(tokens) { | ||
var args, firstToken, _ref1; | ||
var args, firstToken; | ||
firstToken = _.first(tokens); | ||
if (firstToken && ((_ref1 = firstToken.type) === 'list_start' || _ref1 === 'heading')) { | ||
if (firstToken.type === 'heading' && !(firstToken.text === 'Arguments' && firstToken.depth === SpecialHeadingDepth)) { | ||
if (firstToken && firstToken.type === 'heading') { | ||
if (!(firstToken.text === 'Arguments' && firstToken.depth === SpecialHeadingDepth)) { | ||
return; | ||
} | ||
} else if (firstToken && firstToken.type === 'list_start') { | ||
if (!isAtArgumentList(tokens)) { | ||
return; | ||
} | ||
} else { | ||
@@ -234,3 +239,3 @@ return; | ||
parseArgumentList = function(tokens) { | ||
var args, argument, argumentStack, argumentsList, argumentsListStack, depth, foundListStart, parseAsArgumentList, token, _i, _len, _ref1; | ||
var args, argument, argumentStack, argumentsList, argumentsListStack, depth, parseAsArgumentList, token; | ||
depth = 0; | ||
@@ -246,13 +251,3 @@ args = []; | ||
case 'list_start': | ||
foundListStart = false; | ||
parseAsArgumentList = false; | ||
for (_i = 0, _len = tokens.length; _i < _len; _i++) { | ||
token = tokens[_i]; | ||
if ((_ref1 = token.type) === 'list_item_start' || _ref1 === 'loose_item_start') { | ||
foundListStart = true; | ||
} else if (token.type === 'text' && foundListStart) { | ||
parseAsArgumentList = isArgumentListItem(token.text); | ||
break; | ||
} | ||
} | ||
parseAsArgumentList = isAtArgumentList(tokens); | ||
if (parseAsArgumentList) { | ||
@@ -361,2 +356,15 @@ depth++; | ||
isAtArgumentList = function(tokens) { | ||
var foundListStart, token, _i, _len, _ref1; | ||
foundListStart = false; | ||
for (_i = 0, _len = tokens.length; _i < _len; _i++) { | ||
token = tokens[_i]; | ||
if ((_ref1 = token.type) === 'list_item_start' || _ref1 === 'loose_item_start') { | ||
foundListStart = true; | ||
} else if (token.type === 'text' && foundListStart) { | ||
return isArgumentListItem(token.text); | ||
} | ||
} | ||
}; | ||
stopOnSectionBoundaries = function(token, tokens) { | ||
@@ -363,0 +371,0 @@ var listToken, _i, _len, _ref1, _ref2; |
{ | ||
"name": "atomdoc", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A atomdoc parser", | ||
@@ -5,0 +5,0 @@ "main": "./lib/atomdoc.js", |
23918
521