From c97fcab951754808d9bde30426c0fa7d1c3565a8 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 18 Dec 2014 15:54:50 +0000 Subject: [PATCH] update api docs parser --- static/js/apiDialog.js | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/static/js/apiDialog.js b/static/js/apiDialog.js index 5afaf92fa..5d6ba70ca 100644 --- a/static/js/apiDialog.js +++ b/static/js/apiDialog.js @@ -139,10 +139,8 @@ pandora.ui.apiDialog = function() { }) .css({backgroundColor: 'rgba(0, 0, 0, 0)'}), parts, parts_, - colon = ':' - + ' ', - comma = ',' - + ' ', + colon = ':', + comma = ',', linebreak = '
', whitespace = ' '; ['Keyword', 'Method', 'Property'].forEach(function(type) { @@ -153,30 +151,23 @@ pandora.ui.apiDialog = function() { $doc.html( $doc.html().replace(/BOLD(\w+)BOLD/g, '$1') ); - parts = $doc.html().split('notes' + colon); - if (parts.length == 2) { - parts_ = parts[1].split('see' + colon); - if (parts_.length == 2) { - parts_[0] = parts_[0] - .replace(new RegExp(linebreak), whitespace); - parts[1] = parts_.join('see' + colon); - } else { - parts[1] = parts[1].replace(/\n\s+?/g, ' '); - } - $doc.html(parts.join('notes' + colon)); - } - parts = $doc.html().split('see' + colon); + parts = $doc.html().split('see' + colon + whitespace); if (parts.length == 2) { parts[1] = parts[1] - .replace(new RegExp(linebreak), whitespace) - .split(comma) - .map(function(action) { - action = Ox.stripTags(action); - return '' + action + ''; + .split(comma + linebreak) + .map(function(part) { + return part + .split(comma + whitespace) + .map(function(action) { + action = Ox.stripTags(action); + return '' + action + ''; + }) + .join(comma + whitespace); + }) - .join(comma); - $doc.html(parts.join('see' + colon)); + .join(comma + linebreack); + $doc.html(parts.join('see' + colon + whitespace)); } pandora.createLinks($doc); return $doc;