forked from 0x2620/pandora
update api docs parser
This commit is contained in:
parent
3223b291ae
commit
e8d15c1a87
1 changed files with 9 additions and 11 deletions
|
@ -130,11 +130,9 @@ pandora.ui.apiDialog = function() {
|
||||||
*/
|
*/
|
||||||
var $doc = Ox.SyntaxHighlighter({
|
var $doc = Ox.SyntaxHighlighter({
|
||||||
source: string.replace(
|
source: string.replace(
|
||||||
/\n(?=(takes \{|returns \{|notes: |see: ))/g, '\n\n'
|
/\n(?=(takes \{|returns \{|note: |see: ))/g, '\n\n'
|
||||||
).replace(
|
).replace(
|
||||||
/(takes|returns)(?=( \{))/g, 'BOLD$1BOLD'
|
/(takes|returns|notes|see)(?=( \{|: ))/g, 'BOLD$1BOLD'
|
||||||
).replace(
|
|
||||||
/(notes:|see:)(?=( ))/g, 'BOLD$1BOLD'
|
|
||||||
).replace(
|
).replace(
|
||||||
/`/g, 'BOLD'
|
/`/g, 'BOLD'
|
||||||
)
|
)
|
||||||
|
@ -147,20 +145,20 @@ pandora.ui.apiDialog = function() {
|
||||||
$doc.find('.Ox' + type).removeClass('Ox' + type);
|
$doc.find('.Ox' + type).removeClass('Ox' + type);
|
||||||
});
|
});
|
||||||
$doc.html(
|
$doc.html(
|
||||||
$doc.html().replace(/BOLD(\S+)BOLD/g, '<b>$1</b>')
|
$doc.html().replace(/BOLD(\w+)BOLD/g, '<b>$1</b>')
|
||||||
);
|
);
|
||||||
parts = $doc.html().split('<b>notes:</b>');
|
parts = $doc.html().split('<b>notes</b>');
|
||||||
if (parts.length == 2) {
|
if (parts.length == 2) {
|
||||||
parts_ = parts[1].split('<b>see:</b>');
|
parts_ = parts[1].split('<b>see</b>');
|
||||||
if (parts_.length == 2) {
|
if (parts_.length == 2) {
|
||||||
parts_[0] = parts_[0].replace(/\n\s+?/g, ' ');
|
parts_[0] = parts_[0].replace(/\n\s+?/g, ' ');
|
||||||
parts[1] = parts_.join('<b>see:</b>');
|
parts[1] = parts_.join('<b>see</b>');
|
||||||
} else {
|
} else {
|
||||||
parts[1] = parts[1].replace(/\n\s+?/g, ' ');
|
parts[1] = parts[1].replace(/\n\s+?/g, ' ');
|
||||||
}
|
}
|
||||||
$doc.html(parts.join('<b>notes:</b>'));
|
$doc.html(parts.join('<b>notes</b>'));
|
||||||
}
|
}
|
||||||
parts = $doc.html().split('<b>see:</b>');
|
parts = $doc.html().split('<b>see</b>');
|
||||||
if (parts.length == 2) {
|
if (parts.length == 2) {
|
||||||
parts[1] = parts[1].replace(/\n\s+?/, '').split(separator).map(
|
parts[1] = parts[1].replace(/\n\s+?/, '').split(separator).map(
|
||||||
function(action) {
|
function(action) {
|
||||||
|
@ -168,7 +166,7 @@ pandora.ui.apiDialog = function() {
|
||||||
+ action + '</a>';
|
+ action + '</a>';
|
||||||
}
|
}
|
||||||
).join(separator);
|
).join(separator);
|
||||||
$doc.html(parts.join('<b>see:</b>'));
|
$doc.html(parts.join('<b>see</b>'));
|
||||||
}
|
}
|
||||||
pandora.createLinks($doc);
|
pandora.createLinks($doc);
|
||||||
return $doc;
|
return $doc;
|
||||||
|
|
Loading…
Reference in a new issue