api-index: generate index page API list dynamically
Dgeni now generates a JSON file that is loaded by the AppController into the index page for the API docs.
This commit is contained in:
parent
62adb91544
commit
b5744c813a
|
@ -73,6 +73,12 @@ module.exports = new Package('angular.io', [basePackage])
|
|||
pathTemplate: '${originalDoc.path}/_data',
|
||||
outputPathTemplate: '${path}.json'
|
||||
});
|
||||
|
||||
computePathsProcessor.pathTemplates.push({
|
||||
docTypes: ['app-data'],
|
||||
pathTemplate: '../../../../resources/js/app-data',
|
||||
outputPathTemplate: '${path}.json'
|
||||
});
|
||||
})
|
||||
|
||||
.config(function(getLinkInfo) {
|
||||
|
|
|
@ -27,6 +27,12 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||
var extraDocs = [];
|
||||
var modules = [];
|
||||
|
||||
var appDataDoc = {
|
||||
id: 'app-data',
|
||||
docType: 'app-data',
|
||||
data: {}
|
||||
};
|
||||
extraDocs.push(appDataDoc);
|
||||
|
||||
/*
|
||||
* Create Data for Modules
|
||||
|
@ -54,7 +60,8 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||
var dataDoc = {
|
||||
name: exportDoc.name + '-' + exportDoc.docType,
|
||||
title: exportDoc.name,
|
||||
docType: exportDoc.docType
|
||||
docType: exportDoc.docType,
|
||||
exportDoc: exportDoc
|
||||
};
|
||||
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
|
||||
if (exportDoc.originalModule) dataDoc.originalModule = exportDoc.originalModule;
|
||||
|
@ -63,13 +70,13 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||
.sortBy('name')
|
||||
.value();
|
||||
|
||||
// ADD TO APP DATA DOC
|
||||
appDataDoc.data[doc.id] = modulePageInfo;
|
||||
|
||||
|
||||
|
||||
//COMBINE PAGE DATA
|
||||
// COMBINE WITH INDEX PAGE DATA
|
||||
var allPageData = indexPageInfo.concat(modulePageInfo);
|
||||
|
||||
// PUSH DATA TO EXTRA DOCS ARRAY
|
||||
// PUSH JADE DATA DOC TO EXTRA DOCS ARRAY
|
||||
extraDocs.push({
|
||||
id: doc.id + "-data",
|
||||
aliases: [doc.id + "-data"],
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
{%- for module, items in doc.data %}
|
||||
"{$ module $}" : [{% for item in items %}
|
||||
{
|
||||
"title": "{$ item.title $}",
|
||||
"path": "{$ item.exportDoc.path $}",
|
||||
"docType": "{$ item.docType $}"
|
||||
}{% if not loop.last %},{% endif %}
|
||||
{% endfor %}]{% if not loop.last %},{% endif %}
|
||||
{% endfor -%}
|
||||
}
|
|
@ -13,6 +13,6 @@ article(class="l-content-small grid-fluid docs-content")
|
|||
h3 {{ section.title }}
|
||||
ul.api-list
|
||||
li.api-item(ng-repeat='item in apiList[section.name] | filter: { title: apiFilter, docType: apiType }')
|
||||
a(ng-href='{{ section.name }}/{{ item.title }}-{{ item.docType }}.html')
|
||||
a(ng-href='{{ item.path }}')
|
||||
span(class='symbol {{ item.docType }}')
|
||||
| {{ item.title }}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue