forked from 0x2620/pandora
update api dialog
This commit is contained in:
parent
0f1ecec5b5
commit
8b6b23eaf5
1 changed files with 14 additions and 15 deletions
|
@ -111,7 +111,7 @@ pandora.ui.apiDialog = function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getDoc(string) {
|
function getDoc(id) {
|
||||||
/*
|
/*
|
||||||
API Documentation format:
|
API Documentation format:
|
||||||
Description
|
Description
|
||||||
|
@ -128,13 +128,17 @@ pandora.ui.apiDialog = function() {
|
||||||
notes: Notes
|
notes: Notes
|
||||||
see: action, action, ...
|
see: action, action, ...
|
||||||
*/
|
*/
|
||||||
var $doc = Ox.SyntaxHighlighter({
|
var string = actions[id].doc + '\nsource: ' + actions[id].code[0],
|
||||||
|
$doc = Ox.SyntaxHighlighter({
|
||||||
source: '\n' + string.replace(
|
source: '\n' + string.replace(
|
||||||
/\n(?=(takes \{|returns \{|notes: |see: ))/g, '\n\n'
|
/\n(?=(takes \{|returns \{|notes: |see: |source: ))/g,
|
||||||
|
'\n\n'
|
||||||
).replace(
|
).replace(
|
||||||
/(takes|returns|notes|see)(?=( \{|: ))/g, 'BOLD$1BOLD'
|
/(takes|returns|notes|see|source)(?=( \{|: ))/g,
|
||||||
|
'BOLD$1BOLD'
|
||||||
).replace(
|
).replace(
|
||||||
/`/g, 'BOLD'
|
/`/g,
|
||||||
|
'BOLD'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.css({backgroundColor: 'rgba(0, 0, 0, 0)'}),
|
.css({backgroundColor: 'rgba(0, 0, 0, 0)'}),
|
||||||
|
@ -234,23 +238,18 @@ pandora.ui.apiDialog = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.select = function(id) {
|
that.select = function(id) {
|
||||||
|
var $code;
|
||||||
if (id && actions[id]) {
|
if (id && actions[id]) {
|
||||||
$text.empty();
|
$text.empty();
|
||||||
var code = actions[id].code[1],
|
|
||||||
source = actions[id].code[0],
|
|
||||||
line = Math.round(Ox.last(source.split(':')) || 0),
|
|
||||||
$code;
|
|
||||||
$('<h1>')
|
$('<h1>')
|
||||||
.css({paddingLeft: '4px'})
|
.css({paddingLeft: '4px'})
|
||||||
.html('<tt><b>' + id + '</b></tt>')
|
.html('<tt><b>' + id + '</b></tt>')
|
||||||
.appendTo($text);
|
.appendTo($text);
|
||||||
getDoc(actions[id].doc).appendTo($text),
|
getDoc(id).appendTo($text);
|
||||||
$('<div>')
|
|
||||||
.css({paddingLeft: '4px'})
|
|
||||||
.html('<br><tt><b>source</b>: ' + source + '</tt>')
|
|
||||||
.appendTo($text);
|
|
||||||
$code = Ox.SyntaxHighlighter({
|
$code = Ox.SyntaxHighlighter({
|
||||||
source: code.replace(/\s*?'''[\s\S]+?'''/g, ''),
|
source: actions[id].code[1].replace(
|
||||||
|
/\s*?'''[\s\S]+?'''/g, ''
|
||||||
|
),
|
||||||
})
|
})
|
||||||
.css({
|
.css({
|
||||||
backgroundColor: 'rgba(0, 0, 0, 0)',
|
backgroundColor: 'rgba(0, 0, 0, 0)',
|
||||||
|
|
Loading…
Reference in a new issue