From 7ac6bfee1cd76dbb78d6d0665f7ff8ff18bcc8fd Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Thu, 31 Oct 2013 15:32:08 -0700 Subject: [PATCH] cleanup --- plugins/markdown.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/markdown.js b/plugins/markdown.js index 6dcd9aa8..1271bb5d 100644 --- a/plugins/markdown.js +++ b/plugins/markdown.js @@ -12,6 +12,20 @@ var parse = require('jsdoc/util/markdown').getParser(); var tags = []; var excludeTags = []; +function shouldProcessString(tagName, text) { + var shouldProcess = false; + + if (tagName !== 'see') { + shouldProcess = true; + } + // we only want to process `@see` tags that contain Markdown links + else if (tagName === 'see' && text.indexOf('[') !== -1) { + shouldProcess = true; + } + + return shouldProcess; +} + /** * Process the markdown source in a doclet. The properties that should be * processed are configurable, but always include "classdesc", "description", @@ -24,13 +38,10 @@ function process(doclet) { return; } - if (typeof doclet[tag] === "string" && - (tag != 'see' || - // treat '@see' specially, since we only want to process @see text that contains links - (tag == 'see' && doclet[tag].indexOf('[') != -1))) { + if (typeof doclet[tag] === "string" && shouldProcessString(tag, doclet[tag]) ) { doclet[tag] = parse(doclet[tag]); } - else if (doclet[tag] instanceof Array) { + else if ( Array.isArray(doclet[tag]) ) { doclet[tag].forEach(function(value, index, original) { var inner = {}; inner[tag] = value;