From e43769e75d7c35e2f5dd02a4ef8e272937547104 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 18 Dec 2014 15:23:19 +0000 Subject: [PATCH] update api docs parser, remove debugging code --- static/js/apiDialog.js | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/static/js/apiDialog.js b/static/js/apiDialog.js index e1bb31f77..cfc170d9c 100644 --- a/static/js/apiDialog.js +++ b/static/js/apiDialog.js @@ -139,7 +139,7 @@ pandora.ui.apiDialog = function() { }) .css({backgroundColor: 'rgba(0, 0, 0, 0)'}), parts, parts_, - colon = ':' + colon = ':' + ' ', comma = ',' + ' '; @@ -162,7 +162,6 @@ pandora.ui.apiDialog = function() { } $doc.html(parts.join('notes' + colon)); } - Ox.print('DEBUG', $doc.html()) parts = $doc.html().split('see' + colon); if (parts.length == 2) { parts[1] = parts[1].replace(/\n\s+?/, '').split(comma).map( @@ -233,23 +232,30 @@ pandora.ui.apiDialog = function() { that.select = function(id) { if (id && actions[id]) { - $text.html('

' + id + '


'); + $text.html( + '

' + + id + '


' + ); var code = actions[id].code[1], source = actions[id].code[0], line = Math.round(Ox.last(source.split(':')) || 0), - $code, - $doc = getDoc(actions[id].doc).appendTo($text); - $('
') - .html('
' + source + '') - .appendTo($text); - $code = Ox.SyntaxHighlighter({ - source: code.replace(/\s*?'''[\s\S]+?'''/g, ''), - }) - .css({ - backgroundColor: 'rgba(0, 0, 0, 0)', - borderWidth: '1px', - }) - .appendTo($text); + $doc = getDoc(actions[id].doc).appendTo($text), + $source = $('
') + .css({padding: '4px'}) + .html('
' + source + '') + .appendTo($text), + $code = Ox.SyntaxHighlighter({ + source: code.replace(/\s*?'''[\s\S]+?'''/g, ''), + }) + .css({ + backgroundColor: 'rgba(0, 0, 0, 0)', + borderWidth: '1px', + }) + .appendTo($text); + // fix decorators + $code.find('.OxError') + .removeClass('OxError') + .addClass('OxOperator'); } else { $text.empty().append(getIndex()); }