update doc parser regexp
This commit is contained in:
parent
a4f058452e
commit
f989b5bd1a
1 changed files with 6 additions and 3 deletions
|
@ -167,15 +167,18 @@ pandora.ui.apiDialog = function() {
|
||||||
|
|
||||||
that.select = function(id) {
|
that.select = function(id) {
|
||||||
if (id && actions[id]) {
|
if (id && actions[id]) {
|
||||||
$text.html('<h1><b>' + id + '</b><h1><br>');
|
$text.html('<h1><b><tt>' + id + '</tt></b><h1><br>');
|
||||||
var code = actions[id].code[1],
|
var code = actions[id].code[1],
|
||||||
source = actions[id].code[0],
|
source = actions[id].code[0],
|
||||||
line = Math.round(Ox.last(source.split(':')) || 0),
|
line = Math.round(Ox.last(source.split(':')) || 0),
|
||||||
doc = actions[id].doc.replace('/\n/<br>\n/g'),
|
doc = actions[id].doc.replace(/\n(?=(takes|returns) \{)/g, '\n\n'),
|
||||||
$code, $doc;
|
$code, $doc;
|
||||||
$doc = Ox.SyntaxHighlighter({
|
$doc = Ox.SyntaxHighlighter({
|
||||||
source: doc,
|
source: doc,
|
||||||
})
|
})
|
||||||
|
.css({
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0)'
|
||||||
|
})
|
||||||
.appendTo($text);
|
.appendTo($text);
|
||||||
['Keyword', 'Method', 'Property'].forEach(function(type) {
|
['Keyword', 'Method', 'Property'].forEach(function(type) {
|
||||||
$doc.find('.Ox' + type).removeClass('Ox' + type);
|
$doc.find('.Ox' + type).removeClass('Ox' + type);
|
||||||
|
@ -185,9 +188,9 @@ pandora.ui.apiDialog = function() {
|
||||||
.appendTo($text);
|
.appendTo($text);
|
||||||
$code = Ox.SyntaxHighlighter({
|
$code = Ox.SyntaxHighlighter({
|
||||||
source: code.replace(/\s*?'''[\s\S]+?'''/g, ''),
|
source: code.replace(/\s*?'''[\s\S]+?'''/g, ''),
|
||||||
offset: line
|
|
||||||
})
|
})
|
||||||
.css({
|
.css({
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0)',
|
||||||
borderWidth: '1px',
|
borderWidth: '1px',
|
||||||
})
|
})
|
||||||
.appendTo($text);
|
.appendTo($text);
|
||||||
|
|
Loading…
Reference in a new issue