diff options
-rwxr-xr-x | o3d/documentation/build_docs.py | 2 | ||||
-rw-r--r-- | o3d/documentation/jsdoc-toolkit-templates/classtree.tmpl | 6 | ||||
-rw-r--r-- | o3d/documentation/jsdoc-toolkit-templates/publish.js | 67 |
3 files changed, 70 insertions, 5 deletions
diff --git a/o3d/documentation/build_docs.py b/o3d/documentation/build_docs.py index bf98170..bfd3538 100755 --- a/o3d/documentation/build_docs.py +++ b/o3d/documentation/build_docs.py @@ -233,6 +233,8 @@ def BuildCompiledO3DJS(o3djs_files, MakePath('..', '..', 'o3d-internal', 'jscomp', 'JSCompiler_deploy.jar'), '--property_renaming', 'OFF', '--variable_renaming', 'LOCAL', + '--jscomp_error=visibility', + '--jscomp_error=accessControls', '--strict', '--externs=%s' % externs_path, ('--externs=%s' % o3d_externs_js_path), diff --git a/o3d/documentation/jsdoc-toolkit-templates/classtree.tmpl b/o3d/documentation/jsdoc-toolkit-templates/classtree.tmpl index 5080519..e5a04e6 100644 --- a/o3d/documentation/jsdoc-toolkit-templates/classtree.tmpl +++ b/o3d/documentation/jsdoc-toolkit-templates/classtree.tmpl @@ -8,12 +8,8 @@ </ul> </li> <li><a href="/apis/o3d/docs/reference/{+getBaseURL()+}annotated.html">Classes</a> - <ul> {! var allClasses = data.filter(function($){return !$.isNamespace}).sort(makeSortby("alias")); !} - <for each="thisClass" in="allClasses"> - <li><a href="/apis/o3d/docs/reference/{+getBaseURL()+}{+getLinkToClassByAlias(thisClass.alias)+}">{+hyphenateWord(thisClass.name, 16, '-<br/>')+}</a></li> - </for> - </ul> + {+getClassHierarchyHTML(allClasses)+} </li> </ul> diff --git a/o3d/documentation/jsdoc-toolkit-templates/publish.js b/o3d/documentation/jsdoc-toolkit-templates/publish.js index 02cc8bb..0518b6f 100644 --- a/o3d/documentation/jsdoc-toolkit-templates/publish.js +++ b/o3d/documentation/jsdoc-toolkit-templates/publish.js @@ -564,6 +564,73 @@ function getParameters(symbol) { } /** + * Generates an HTML class hierarchy. + * @param {!Array.<!Symbol>} classes Class to make hierarchy from. + * @return {string} HTML hierarchical list of classes. + */ +function getClassHierarchyHTML(classes) { + var classTree = {}; + + for (var cc = 0; cc < classes.length; ++cc) { + var thisClass = classes[cc]; + var stack = [thisClass]; + while (thisClass.inheritsFrom !== undefined && + thisClass.inheritsFrom.length > 0) { + var parentName = thisClass.inheritsFrom[0]; + thisClass = getSymbol(parentName); + stack.push(thisClass); + } + + var node = classTree; + for (var ii = stack.length - 1; ii >= 0; --ii) { + var thisClass = stack[ii]; + var className = thisClass.alias; + if (!node[className]) { + node[className] = { }; + } + node = node[className]; + } + } + + return addParts(classTree, ''); + + /** + * Recursively creates hierarchical list of classes. + * @param {!Object} node A hash of class names to derived classes. + * @param {string} prefix Prefix to put in front of each line. + */ + function addParts(node, prefix) { + var output = ''; + var names = []; + for (var name in node) { + names.push(name); + } + if (names.length > 0) { + output += prefix + '<ul>\n'; + names = names.sort(); + for (var kk = 0; kk < names.length; ++kk) { + var name = names[kk]; + var shortName = name; + var period = name.lastIndexOf('.'); + if (period >= 0) { + shortName = name.substr(period + 1); + } + output += prefix + '<li><a href="/apis/o3d/docs/reference/' + + getBaseURL() + + getLinkToClassByAlias(name) + + '">' + + hyphenateWord(shortName, 16, '-<br/>') + + '</a>'; + output += addParts(node[name], prefix + ' ') + '\n'; + output += prefix + '</li>\n'; + } + output += prefix + '</ul>\n'; + } + return output; + } +} + +/** * Returns whether or not the symbol is deprecated. Apparently jsdoctoolkit is * supposed to extract this info for us but it's not so we have to do it * manually. |