Skip to content

Commit 85799aa

Browse files
petebacondarwinmhevery
authored andcommitted
docs(*): add @publicModule tags
Initial set of tags to demonstrate the public docs filtering Closes angular#988
1 parent 8229d7e commit 85799aa

File tree

14 files changed

+299
-210
lines changed

14 files changed

+299
-210
lines changed

docs/dgeni-package/processors/processClassDocs.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ module.exports = function processClassDocs(log, getJSDocComment) {
55
return {
66
$runAfter: ['processModuleDocs'],
77
$runBefore: ['parsing-tags', 'generateDocsFromComments'],
8+
ignorePrivateMembers: false,
89
$process: function(docs) {
910
var memberDocs = [];
11+
var ignorePrivateMembers = this.ignorePrivateMembers;
1012
_.forEach(docs, function(classDoc) {
1113
if ( classDoc.docType === 'class' ) {
1214

@@ -15,13 +17,16 @@ module.exports = function processClassDocs(log, getJSDocComment) {
1517
// Create a new doc for each member of the class
1618
_.forEach(classDoc.elements, function(memberDoc) {
1719

20+
if (ignorePrivateMembers && memberDoc.name.literalToken.value.charAt(0) === '_') return;
21+
1822
classDoc.members.push(memberDoc);
1923
memberDocs.push(memberDoc);
2024

2125
memberDoc.docType = 'member';
2226
memberDoc.classDoc = classDoc;
2327
memberDoc.name = memberDoc.name.literalToken.value;
2428

29+
2530
if (memberDoc.commentBefore ) {
2631
// If this export has a comment, remove it from the list of
2732
// comments collected in the module

docs/dgeni-package/services/ExportTreeVisitor.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ module.exports = function ExportTreeVisitor(ParseTreeVisitor, log) {
1717
ParseTreeVisitor.prototype.visitExportDeclaration.call(this, tree);
1818
log.silly('exit', this.currentExport);
1919

20-
// We are exiting the export declaration - store the export object
21-
this.exports.push(this.currentExport);
20+
if(this.currentExport) {
21+
// We are exiting the export declaration - store the export object
22+
this.exports.push(this.currentExport);
23+
}
2224
this.currentExport = null;
2325
},
2426

@@ -78,14 +80,15 @@ module.exports = function ExportTreeVisitor(ParseTreeVisitor, log) {
7880
},
7981

8082
visitNamedExport: function(tree) {
81-
if ( this.currentExport ) {
82-
this.updateExport(tree);
83+
this.currentExport = null;
84+
// if ( this.currentExport ) {
85+
// this.updateExport(tree);
8386

84-
this.currentExport.namedExport = tree;
85-
this.currentExport.name = 'NAMED_EXPORT';
86-
// TODO: work out this bit!!
87-
// We need to cope with any export specifiers in the named export
88-
}
87+
// this.currentExport.namedExport = tree;
88+
// this.currentExport.name = 'NAMED_EXPORT';
89+
// // TODO: work out this bit!!
90+
// // We need to cope with any export specifiers in the named export
91+
// }
8992
},
9093

9194
// TODO - if the export is an expression, find the thing that is being

docs/public-docs-package/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ module.exports = new Package('angular-public', [basePackage])
1010
parseTagsProcessor.tagDefinitions.push({ name: 'publicModule' });
1111
})
1212

13+
.config(function(processClassDocs) {
14+
processClassDocs.ignorePrivateMembers = true;
15+
})
16+
1317
// Configure file writing
1418
.config(function(writeFilesProcessor) {
1519
writeFilesProcessor.outputFolder = 'dist/public_docs';

0 commit comments

Comments
 (0)