diff --git a/lib/jsdoc/doclet.js b/lib/jsdoc/doclet.js index 0513db2d..70a76e35 100644 --- a/lib/jsdoc/doclet.js +++ b/lib/jsdoc/doclet.js @@ -77,19 +77,24 @@ function unwrap(docletSrc) { return docletSrc; } -function split(docletSrc) { - var tagSrcs = []; +/** + * Convert the raw source of the doclet comment into an array of pseudo-Tag objects. + * @private + */ +function toTags(docletSrc) { + var parsedTag; + var tagData = []; + var tagText; + var tagTitle; // split out the basic tags, keep surrounding whitespace // like: @tagTitle tagBody docletSrc - .replace(/^(\s*)@(\S)/gm, '$1\\@$2') // replace splitter ats with an arbitrary sequence - .split('\\@') // then split on that arbitrary sequence + // replace splitter ats with an arbitrary sequence + .replace(/^(\s*)@(\S)/gm, '$1\\@$2') + // then split on that arbitrary sequence + .split('\\@') .forEach(function($) { - var parsedTag; - var tagText; - var tagTitle; - if ($) { parsedTag = $.match(/^(\S+)(:?\s+(\S[\s\S]*))?/); @@ -99,7 +104,7 @@ function split(docletSrc) { tagText = parsedTag[2]; if (tagTitle) { - tagSrcs.push({ + tagData.push({ title: tagTitle, text: tagText }); @@ -108,22 +113,7 @@ function split(docletSrc) { } }); - return tagSrcs; -} - -/** - * Convert the raw source of the doclet comment into an array of Tag objects. - * @private - */ -function toTags(docletSrc) { - var tags = []; - var tagSrcs = split(docletSrc); - - for (var i = 0, l = tagSrcs.length; i < l; i++) { - tags.push({ title: tagSrcs[i].title, text: tagSrcs[i].text }); - } - - return tags; + return tagData; } function fixDescription(docletSrc) {