doc-gen: fix filterable API list

Closes #2054
This commit is contained in:
Peter Bacon Darwin 2016-08-09 17:38:25 +01:00 committed by Naomi Black
parent ef1171bd36
commit 2fb503dabf
3 changed files with 34 additions and 14 deletions

View File

@ -138,7 +138,7 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
});
computePathsProcessor.pathTemplates.push({
docTypes: ['api-list-data'],
docTypes: ['api-list-audit'],
pathTemplate: 'api-list-audit.json',
outputPathTemplate: '${path}'
});

View File

@ -26,15 +26,26 @@ module.exports = function addJadeDataDocsProcessor() {
$process: function(docs) {
var extraDocs = [];
var modules = [];
var data = {};
var appDataDoc = {
id: 'api-list-data',
aliases: ['api-list-data'],
docType: 'api-list-data',
data: {}
data: data
};
extraDocs.push(appDataDoc);
// create additional doc for auditing
var appDataAuditDoc = {
id: 'api-list-audit',
aliases: ['api-list-audit'],
docType: 'api-list-audit',
data: data
};
extraDocs.push(appDataAuditDoc);
/*
* Create Data for Modules
*
@ -76,7 +87,7 @@ module.exports = function addJadeDataDocsProcessor() {
stability = 'deprecated';
exportDoc.showDeprecatedNotes = true;
}
var howToUse = '';
if(_.has(exportDoc, 'howToUse')) {
var howToUseArray = exportDoc.tags.tags.filter(function(tag) {
@ -135,7 +146,7 @@ module.exports = function addJadeDataDocsProcessor() {
doc.childPages = modulePageInfo;
// ADD TO APP DATA DOC
appDataDoc.data[doc.id] = modulePageInfo;
data[doc.id] = modulePageInfo;
// COMBINE WITH INDEX PAGE DATA
var allPageData = indexPageInfo.concat(modulePageInfo);

View File

@ -32,8 +32,18 @@ describe('addJadeDataDocsProcessor', function() {
originalDoc : docs[0],
data : [
{ name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' },
{ name : 'someObj-var', title : 'someObj', varType : 'MyClass', docType: 'var',
originalModule: 'some/private/module', exportDoc: exportDoc }
{
name : 'someObj-var',
title : 'someObj',
varType : 'MyClass',
docType: 'var',
originalModule: 'some/private/module',
exportDoc: exportDoc,
stability : '',
howToUse : '',
whatItDoes : '',
security : false
}
] });
});
@ -56,14 +66,13 @@ describe('addJadeDataDocsProcessor', function() {
];
docs = processor.$process(docs);
expect(docs[2].data).toEqual([
{ name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' },
{ name: 'Alpha-class', title: 'Alpha', docType: 'class', exportDoc: alpha },
{ name: 'Beta-class', title: 'Beta', docType: 'class', exportDoc: beta },
{ name: 'Gamma-class', title: 'Gamma', docType: 'class', exportDoc: gamma },
{ name: 'Mu-class', title: 'Mu', docType: 'class', exportDoc: mu },
{ name: 'Nu-class', title: 'Nu', docType: 'class', exportDoc: nu }
]);
expect(docs[2].data).toEqual({ someModule : [
{ name: 'Alpha-class', title: 'Alpha', docType: 'class', exportDoc: alpha, stability : '', howToUse : '', whatItDoes : '', security : false },
{ name: 'Beta-class', title: 'Beta', docType: 'class', exportDoc: beta, stability : '', howToUse : '', whatItDoes : '', security : false },
{ name: 'Gamma-class', title: 'Gamma', docType: 'class', exportDoc: gamma, stability : '', howToUse : '', whatItDoes : '', security : false },
{ name: 'Mu-class', title: 'Mu', docType: 'class', exportDoc: mu, stability : '', howToUse : '', whatItDoes : '', security : false },
{ name: 'Nu-class', title: 'Nu', docType: 'class', exportDoc: nu, stability : '', howToUse : '', whatItDoes : '', security : false }
]});
});
});