From e8d15c1a87f340b841e940d903376e31c32c1e02 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 18 Dec 2014 14:45:54 +0000 Subject: [PATCH] update api docs parser --- static/js/apiDialog.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/static/js/apiDialog.js b/static/js/apiDialog.js index 32d412d13..1b5ddde01 100644 --- a/static/js/apiDialog.js +++ b/static/js/apiDialog.js @@ -130,11 +130,9 @@ pandora.ui.apiDialog = function() { */ var $doc = Ox.SyntaxHighlighter({ source: string.replace( - /\n(?=(takes \{|returns \{|notes: |see: ))/g, '\n\n' + /\n(?=(takes \{|returns \{|note: |see: ))/g, '\n\n' ).replace( - /(takes|returns)(?=( \{))/g, 'BOLD$1BOLD' - ).replace( - /(notes:|see:)(?=( ))/g, 'BOLD$1BOLD' + /(takes|returns|notes|see)(?=( \{|: ))/g, 'BOLD$1BOLD' ).replace( /`/g, 'BOLD' ) @@ -147,20 +145,20 @@ pandora.ui.apiDialog = function() { $doc.find('.Ox' + type).removeClass('Ox' + type); }); $doc.html( - $doc.html().replace(/BOLD(\S+)BOLD/g, '$1') + $doc.html().replace(/BOLD(\w+)BOLD/g, '$1') ); - parts = $doc.html().split('notes:'); + parts = $doc.html().split('notes'); if (parts.length == 2) { - parts_ = parts[1].split('see:'); + parts_ = parts[1].split('see'); if (parts_.length == 2) { parts_[0] = parts_[0].replace(/\n\s+?/g, ' '); - parts[1] = parts_.join('see:'); + parts[1] = parts_.join('see'); } else { parts[1] = parts[1].replace(/\n\s+?/g, ' '); } - $doc.html(parts.join('notes:')); + $doc.html(parts.join('notes')); } - parts = $doc.html().split('see:'); + parts = $doc.html().split('see'); if (parts.length == 2) { parts[1] = parts[1].replace(/\n\s+?/, '').split(separator).map( function(action) { @@ -168,7 +166,7 @@ pandora.ui.apiDialog = function() { + action + ''; } ).join(separator); - $doc.html(parts.join('see:')); + $doc.html(parts.join('see')); } pandora.createLinks($doc); return $doc;