1
0
Fork 0
forked from 0x2620/oxjs

parse and display inherited events

This commit is contained in:
rolux 2012-06-02 14:10:59 +02:00
commit e348acee86
2 changed files with 58 additions and 37 deletions

View file

@ -94,17 +94,25 @@ Ox.DocPage = function(options, self) {
sections = ['description'].concat(
item.order || ['returns', 'arguments', 'properties']
).concat(['events', 'tests', 'source']),
index = sections.indexOf('properties') + 1 || 1;
if (item.inherited) {
Array.prototype.splice.apply(sections, [index, 0].concat(
item.inherited.map(function(v, i) {
var section = 'Properties inherited from <code>'
+ v.name + '</code>';
item[section] = v.properties;
return section;
})
));
}
index = {
events: sections.indexOf('events') + 1 + (
item.inheritedproperties ? item.inheritedproperties.length : 0
),
properties: sections.indexOf('properties') + 1 || 1
};
['properties', 'events'].forEach(function(key) {
var key_ = 'inherited' + key;
if (item[key_]) {
Array.prototype.splice.apply(sections, [index[key], 0].concat(
item[key_].map(function(v, i) {
var section = key + ' inherited from <code>'
+ v.name + '</code>';
item[section] = v[key];
return section;
})
));
}
});
sections.forEach(function(section) {
var className = 'OxLine' + Ox.uid();
if (item[section]) {
@ -163,12 +171,13 @@ Ox.DocPage = function(options, self) {
})
)
.append('<span class="OxSection">' + (
Ox.startsWith(section, 'Properties') ? section
: Ox.toTitleCase(
section == 'returns' ? 'usage'
: section == 'tests' ? 'examples'
: section
)
Ox.contains(section, 'inherited')
? section[0].toUpperCase() + section.slice(1)
: Ox.toTitleCase(
section == 'returns' ? 'usage'
: section == 'tests' ? 'examples'
: section
)
) + '</span>')
);
if (section == 'tests') {