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),