Files
openlayers/buildcfg/jsdoc/symbols/publish.js
Andreas Hocevar fbdbbfb7a7 Get rid of stability annotations and document stability with api
This change adds a stability value to the api annotation, with
'experimental' as default value.

enum, typedef and event annotations are never exportable, but
api annotations are needed there to make them appear in the
docs.

Nested typedefs are no longer inlined recursively, because the
resulting tables get too wide with the current template.
2014-04-29 09:53:07 -06:00

46 lines
1.3 KiB
JavaScript

/**
* @fileoverview Generates JSON output based on doclets with the "api" tag.
*/
var assert = require('assert');
var fs = require('fs');
var path = require('path');
/**
* Publish hook for the JSDoc template. Writes to JSON stdout.
* @param {function} data The root of the Taffy DB containing doclet records.
* @param {Object} opts Options.
*/
exports.publish = function(data, opts) {
var cwd = process.cwd();
// get all doclets with the "api" property, but no enums, typedefs and events.
var docs = data(
{api: {isString: true}},
{isEnum: {'!is': true}},
{kind: {'!is': 'typedef'}},
{kind: {'!is': 'event'}}
).get();
// get symbols data, filter out those that are members of private classes
var symbols = docs.filter(function(doc) {
var include = true;
var constructor = doc.memberof;
if (constructor && constructor.substr(-1) === '_') {
assert.strictEqual(doc.inherited, true,
'Unexpected export on private class: ' + doc.longname);
include = false;
}
return include;
}).map(function(doc) {
return {
name: doc.longname,
extends: doc.augments,
path: path.join(doc.meta.path, doc.meta.filename)
};
});
process.stdout.write(JSON.stringify({symbols: symbols}, null, 2));
};