update DocPage ('examples' property renamed to 'tests')

This commit is contained in:
rolux 2012-05-27 16:54:20 +02:00
parent b4bb926c0c
commit 27b55e2b6e

View file

@ -93,7 +93,7 @@ Ox.DocPage = function(options, self) {
]; ];
[ [
'description', 'usage', 'arguments', 'properties', 'description', 'usage', 'arguments', 'properties',
'events', 'examples', 'source' 'events', 'tests', 'source'
].forEach(function(section) { ].forEach(function(section) {
var className = 'OxLine' + Ox.uid(); var className = 'OxLine' + Ox.uid();
if (item[section]) { if (item[section]) {
@ -151,26 +151,28 @@ Ox.DocPage = function(options, self) {
}); });
}) })
) )
.append('<span class="OxSection">' + Ox.toTitleCase(section) + '</span>') .append('<span class="OxSection">' + Ox.toTitleCase(
section == 'tests' ? 'examples' : section
) + '</span>')
); );
if (section == 'examples') { if (section == 'tests') {
item.examples.forEach(function(example) { item.tests.forEach(function(test) {
$elements.push($('<div>') $elements.push($('<div>')
.addClass(className) .addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'}) .css({marginLeft: (level * 32 + 16) + 'px'})
.html( .html(
'<code><b>&gt;&nbsp;' '<code><b>&gt;&nbsp;'
+ Ox.encodeHTMLEntities(example.statement) + Ox.encodeHTMLEntities(test.statement)
.replace(/ /g, '&nbsp;') .replace(/ /g, '&nbsp;')
.replace(/\n/g, '<br/>\n&nbsp;&nbsp;') .replace(/\n/g, '<br/>\n&nbsp;&nbsp;')
+ '</b></code>' + '</b></code>'
) )
); );
example.result && $elements.push($('<div>') test.result && $elements.push($('<div>')
.addClass(className) .addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'}) .css({marginLeft: (level * 32 + 16) + 'px'})
.html( .html(
'<code>' + Ox.encodeHTMLEntities(example.result) + '</code>' '<code>' + Ox.encodeHTMLEntities(test.result) + '</code>'
) )
) )
}); });
@ -184,7 +186,7 @@ Ox.DocPage = function(options, self) {
+ '</b>:' + self.options.item.line + '</code>' + '</b>:' + self.options.item.line + '</code>'
) )
); );
Ox.print('IS::', item.source); //Ox.print('IS::', item.source);
$elements.push( $elements.push(
Ox.SyntaxHighlighter({ Ox.SyntaxHighlighter({
replace: self.options.replace, replace: self.options.replace,