yuidoc: updated generators and templates to fix IE sidebar issue

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Tudor Panu
2015-06-04 10:31:38 -07:00
parent d493c015fd
commit 0c46dd28be
7 changed files with 179 additions and 43 deletions

View File

@ -46,7 +46,7 @@ function generateDocs(specjs) {
docs += GENERATE_MODULE('common', '');
var grouped = _.flatten(_.pluck(_.values(specjs.CLASSGROUPS), 'classes'));
var ungrouped = _.difference(_.keys(specjs.CLASSES), grouped);
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped), 'common');
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped), 'common');
_.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, groupSpec.classes), groupName);
});
@ -76,7 +76,7 @@ function GENERATE_MODULE(name, description) {
function GENERATE_CLASSES(classes, parent) {
return _.reduce(classes, function(memo, classSpec, className) {
return memo
+ GENERATE_CLASS(className, classSpec.description, parent)
+ GENERATE_CLASS(className, classSpec.description, parent, classSpec.parent)
+ _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
return memo += GENERATE_METHOD(methodName, methodSpec, className);
}, '')
@ -91,15 +91,21 @@ function GENERATE_CLASSES(classes, parent) {
// generate class spec
function GENERATE_CLASS(name, description, parent) {
function GENERATE_CLASS(name, description, namespace, parent) {
return GENERATE_DOC(description + '\n'
+ '@class ' + name + '\n'
+ (parent ? ('@module ' + parent + '\n') : ''));
+ (namespace ? ('@module ' + namespace + '\n') : '')
/*
TODO: leave out until figure out what swig does with inheritance
+ (parent ? ('@extends ' + parent + '\n') : '')
*/
);
}
// generate method spec with parent module/class
function GENERATE_METHOD(name, spec, parent) {
name = name.replace(/!+$/, '');
return GENERATE_DOC(spec.description + '\n'
+ '@method ' + name + '\n'
+ (parent ? ('@for ' + parent + '\n') : '@for common\n')

View File

@ -77,17 +77,15 @@ function listByGroup(modules, classes, field, projectRoot) {
var groups = Object.keys(modulesByGroup).sort();
var html = '';
var pfx = projectRoot + 'modules/';
var first = true;
for (i = 0; i < groups.length; i++) {
var group = groups[i];
html += (first ? '' : '</span>');
html += '<div class="upmGroup"><div class="right-arrow"></div>' + group + '</div><span class="upmModules" style="display:none">';
var moduleNames = modulesByGroup[group];
for (j = 0; j < moduleNames.length; j++) {
var moduleName = moduleNames[j];
html += '<a href="' + pfx + moduleName + '.html">' + moduleName + '</a>';
}
first = false;
html += '</span>';
}
return html;
}
@ -117,7 +115,7 @@ var insertStyles = "Y.one(document.head).append('<style> \
font-size: 0; \
margin-right: 5px; \
vertical-align: 5px; \
display: inline; \
float: left \
} \
div.down-arrow { \
width: 0; \
@ -127,7 +125,7 @@ var insertStyles = "Y.one(document.head).append('<style> \
border-top: 5px solid #356de4; \
font-size: 0; \
margin-right: 5px; \
display: inline; \
float: left \
} \
div.upmGroup { \
font-weight: bold; \
@ -137,7 +135,7 @@ var insertStyles = "Y.one(document.head).append('<style> \
var scripts = "YUI().use('node', 'event', function (Y) {"
+ onClickHandler
+ insertStyles
// + insertStyles
+ "});";

View File

@ -787,3 +787,28 @@ kbd .cmd { font-family: Monaco, Helvetica; }
font-weight: bold;
}
div.right-arrow {
width: 0;
height: 0;
border-bottom: 5px solid transparent;
border-top: 5px solid transparent;
border-left: 5px solid #356de4;
font-size: 0;
margin-right: 5px;
float: left
}
div.down-arrow {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #356de4;
font-size: 0;
margin-right: 5px;
float: left
}
div.upmGroup {
font-weight: bold;
}