From 77119b8f2eb5aba2a519924f4d108d68dff2c255 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 18 Dec 2014 15:42:05 +0000 Subject: [PATCH] update api docs parser --- static/js/apiDialog.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/static/js/apiDialog.js b/static/js/apiDialog.js index 2b512a93d..5afaf92fa 100644 --- a/static/js/apiDialog.js +++ b/static/js/apiDialog.js @@ -142,7 +142,9 @@ pandora.ui.apiDialog = function() { colon = ':' + ' ', comma = ',' - + ' '; + + ' ', + linebreak = '
', + whitespace = ' '; ['Keyword', 'Method', 'Property'].forEach(function(type) { $doc.find('.Ox' + type) .removeClass('Ox' + type) @@ -155,7 +157,8 @@ pandora.ui.apiDialog = function() { if (parts.length == 2) { parts_ = parts[1].split('see' + colon); if (parts_.length == 2) { - parts_[0] = parts_[0].replace(/\n\s+?/g, ' '); + parts_[0] = parts_[0] + .replace(new RegExp(linebreak), whitespace); parts[1] = parts_.join('see' + colon); } else { parts[1] = parts[1].replace(/\n\s+?/g, ' '); @@ -164,13 +167,15 @@ pandora.ui.apiDialog = function() { } parts = $doc.html().split('see' + colon); if (parts.length == 2) { - parts[1] = parts[1].replace(/\n\s+?/, '').split(comma).map( - function(action) { + parts[1] = parts[1] + .replace(new RegExp(linebreak), whitespace) + .split(comma) + .map(function(action) { action = Ox.stripTags(action); return '' + action + ''; - } - ).join(comma); + }) + .join(comma); $doc.html(parts.join('see' + colon)); } pandora.createLinks($doc); @@ -233,6 +238,7 @@ pandora.ui.apiDialog = function() { that.select = function(id) { if (id && actions[id]) { + $text.empty(); var code = actions[id].code[1], source = actions[id].code[0], line = Math.round(Ox.last(source.split(':')) || 0),