angular-docs-cn/tools/api-builder/docs-package/processors/addNotYetDocumentedProperty.js
Peter Bacon Darwin dbc95b75af api-builder: improve "not yet documented" handling
* All export members are now tagged if they have no documentation.
* All exports are tagged if they and their members have no documentation.
* The templates for these docs display the words "Not Yet Documented" if they are tagged.
* The build creates a warning for each export that is not documented
* The build generates a new file, `public/docs/ts/latest/api/overview-dump.html`, which
lists all the modules, exports and members highlighting those that are not documented.
2015-11-13 16:39:20 +00:00

33 lines
1.1 KiB
JavaScript

module.exports = function addNotYetDocumentedProperty(EXPORT_DOC_TYPES, log, createDocMessage) {
return {
$runAfter: ['tags-parsed'],
$runBefore: ['rendering-docs'],
$process: function(docs) {
docs.forEach(function(doc) {
if (EXPORT_DOC_TYPES.indexOf(doc.docType) === -1) return;
// NotYetDocumented means that no top level comments and no member level comments
doc.notYetDocumented = doc.description.trim().length == 0;
if (doc.constructorDoc) {
doc.constructorDoc.notYetDocumented = doc.constructorDoc.description.trim().length == 0;
doc.notYetDocumented = doc.notYetDocumented && doc.constructorDoc.notYetDocumented;
}
if (doc.members) {
doc.members.forEach(function(member) {
member.notYetDocumented = member.description.trim().length == 0;
doc.notYetDocumented = doc.notYetDocumented && member.notYetDocumented;
});
}
if (doc.notYetDocumented) {
log.warn(createDocMessage("Not yet documented", doc));
}
});
return docs;
}
};
};