Only document the exported API, not every symbol
There is more work to be done, because this filters out more than desired, and we don't have events documented yet.
This commit is contained in:
1 parent
ee987bc951
commit
2fd185c966
3 files changed
+76
-1
No files matched your search
@@ -572,6 +572,7 @@ virtual('doc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
|
||||
|
||||
|
||||
@target('build/jsdoc-%(BRANCH)s-timestamp' % vars(variables), 'host-resources',
|
||||
'build/src/external/src/exports.js', 'build/src/external/src/types.js',
|
||||
SRC, SHADER_SRC, ifind('doc/template'))
|
||||
def jsdoc_BRANCH_timestamp(t):
|
||||
t.run('%(JSDOC)s', '-c', 'doc/conf.json', 'src', 'doc/index.md',
|
||||
|
||||
+5
-1
@@ -11,7 +11,11 @@
|
||||
"includePattern": ".+\\.js(doc)?$",
|
||||
"excludePattern": "(^|\\/|\\\\)_"
|
||||
},
|
||||
"plugins": [ "plugins/markdown", "doc/plugins/inheritdoc" ],
|
||||
"plugins": [
|
||||
"plugins/markdown",
|
||||
"doc/plugins/inheritdoc",
|
||||
"doc/plugins/exports"
|
||||
],
|
||||
"markdown": {
|
||||
"parser": "gfm"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
var api = [];
|
||||
|
||||
function collectExports(source) {
|
||||
var i, ii, symbol, property;
|
||||
var syms = source.match(/goog\.exportSymbol\([^\)]*\)/g);
|
||||
if (syms) {
|
||||
i = 0; ii = syms.length;
|
||||
for (; i < ii; ++i) {
|
||||
symbol = syms[i].match(/'([^']*)'/)[1];
|
||||
api.push(symbol);
|
||||
}
|
||||
}
|
||||
var props = source.match(/goog\.exportProperty\([^\)]*\)/g);
|
||||
if (props) {
|
||||
i = 0; ii = props.length;
|
||||
for (; i < ii; ++i) {
|
||||
property = props[i].match(/[^,]*,[^,]*,\r?\n? *([^\)]*)\)/)[1]
|
||||
.replace('.prototype.', '#');
|
||||
api.push(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var encoding = env.conf.encoding || 'utf8';
|
||||
var fs = require('jsdoc/fs');
|
||||
|
||||
collectExports(fs.readFileSync('build/src/external/src/exports.js', encoding));
|
||||
|
||||
var types = fs.readFileSync('build/src/external/src/types.js', encoding);
|
||||
collectExports(types);
|
||||
var typedefs = types.match(/goog\.provide\('[^']*'\)/g);
|
||||
var typedef, namespace;
|
||||
for (var i = 0, ii = typedefs.length; i < ii; ++ i) {
|
||||
typedef = typedefs[i].match(/'([^']*)'/)[1];
|
||||
api.push(typedef);
|
||||
namespace = typedef.substr(0, typedef.lastIndexOf('.'));
|
||||
if (api.indexOf(namespace) === -1) {
|
||||
api.push(namespace);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exports.handlers = {
|
||||
|
||||
beforeParse: function(e) {
|
||||
if (/\.js$/.test(e.filename)) {
|
||||
collectExports(e.source);
|
||||
}
|
||||
},
|
||||
|
||||
newDoclet: function(e) {
|
||||
var fqn = e.doclet.longname;
|
||||
if (fqn) {
|
||||
if (api.indexOf(fqn) === -1) {
|
||||
e.doclet.undocumented = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
exports.nodeVisitor = {
|
||||
|
||||
visitNode: function(node, e, parser, currentSourceName) {
|
||||
if (e.code) {
|
||||
//console.log(e.source);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user