feat(angular.io-package): render the originalModule field in the jade-data docs

This commit is contained in:
Peter Bacon Darwin 2015-09-18 12:12:32 +01:00 committed by Jay Traband
parent 4813e9e172
commit 6e643c9622
3 changed files with 18 additions and 10 deletions

View File

@ -51,18 +51,21 @@ module.exports = function addJadeDataDocsProcessor() {
// GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS) // GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS)
var modulePageInfo = _(doc.exports) var modulePageInfo = _(doc.exports)
.map(function(exportDoc) { .map(function(exportDoc) {
return { var dataDoc = {
name: exportDoc.name + '-' + exportDoc.docType, name: exportDoc.name + '-' + exportDoc.docType,
title: exportDoc.name, title: exportDoc.name,
docType: exportDoc.docType, docType: exportDoc.docType
varType: exportDoc.symbolTypeName && titleCase(exportDoc.symbolTypeName)
}; };
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
if (exportDoc.originalModule) dataDoc.originalModule = exportDoc.originalModule;
return dataDoc;
}) })
.sortBy('name') .sortBy('name')
.value(); .value();
//COMBINE PAGE DATA //COMBINE PAGE DATA
var allPageData = indexPageInfo.concat(modulePageInfo); var allPageData = indexPageInfo.concat(modulePageInfo);

View File

@ -15,7 +15,9 @@ describe('addJadeDataDocsProcessor', function() {
{ {
docType: 'module', docType: 'module',
id: 'someModule', id: 'someModule',
exports: [{ name: 'someObj', docType: 'var', symbolTypeName: 'MyClass'}], exports: [
{ name: 'someObj', docType: 'var', symbolTypeName: 'MyClass', originalModule: 'some/private/module' }
],
fileInfo: { baseName: 'x_y' }, fileInfo: { baseName: 'x_y' },
description: 'some description\nsecond line' description: 'some description\nsecond line'
} }
@ -29,7 +31,7 @@ describe('addJadeDataDocsProcessor', function() {
originalDoc : docs[0], originalDoc : docs[0],
data : [ data : [
{ name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' }, { name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' },
{ name : 'someObj-var', title : 'someObj', varType : 'MyClass', docType: 'var' } { name : 'someObj-var', title : 'someObj', varType : 'MyClass', docType: 'var', originalModule: 'some/private/module' }
] }); ] });
}); });
@ -53,11 +55,11 @@ describe('addJadeDataDocsProcessor', function() {
expect(docs[1].data).toEqual([ expect(docs[1].data).toEqual([
{ name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' }, { name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' },
{ name: 'Alpha-class', title: 'Alpha', varType : undefined, docType: 'class' }, { name: 'Alpha-class', title: 'Alpha', docType: 'class' },
{ name: 'Beta-class', title: 'Beta', varType : undefined, docType: 'class' }, { name: 'Beta-class', title: 'Beta', docType: 'class' },
{ name: 'Gamma-class', title: 'Gamma', varType : undefined, docType: 'class' }, { name: 'Gamma-class', title: 'Gamma', docType: 'class' },
{ name: 'Mu-class', title: 'Mu', varType : undefined, docType: 'class' }, { name: 'Mu-class', title: 'Mu', docType: 'class' },
{ name: 'Nu-class', title: 'Nu', varType : undefined, docType: 'class' } { name: 'Nu-class', title: 'Nu', docType: 'class' }
]); ]);
}); });

View File

@ -8,6 +8,9 @@
{%- if item.varType %} {%- if item.varType %}
"varType" : "{$ item.varType $}", "varType" : "{$ item.varType $}",
{%- endif %} {%- endif %}
{%- if item.originalModule %}
"originalModule" : "{$ item.originalModule $}",
{%- endif %}
"docType": "{$ item.docType $}" "docType": "{$ item.docType $}"
}{% if not loop.last %},{% endif %} }{% if not loop.last %},{% endif %}
{% endfor -%} {% endfor -%}