update api docs parser

This commit is contained in:
rolux 2014-12-18 14:45:54 +00:00
parent 3223b291ae
commit e8d15c1a87

View file

@ -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, '<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) {
parts_ = parts[1].split('<b>see:</b>');
parts_ = parts[1].split('<b>see</b>');
if (parts_.length == 2) {
parts_[0] = parts_[0].replace(/\n\s+?/g, ' ');
parts[1] = parts_.join('<b>see:</b>');
parts[1] = parts_.join('<b>see</b>');
} else {
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) {
parts[1] = parts[1].replace(/\n\s+?/, '').split(separator).map(
function(action) {
@ -168,7 +166,7 @@ pandora.ui.apiDialog = function() {
+ action + '</a>';
}
).join(separator);
$doc.html(parts.join('<b>see:</b>'));
$doc.html(parts.join('<b>see</b>'));
}
pandora.createLinks($doc);
return $doc;