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',
|
pathTemplate: '${originalDoc.path}/_data',
|
||||||
outputPathTemplate: '${path}.json'
|
outputPathTemplate: '${path}.json'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
computePathsProcessor.pathTemplates.push({
|
||||||
|
docTypes: ['app-data'],
|
||||||
|
pathTemplate: '../../../../resources/js/app-data',
|
||||||
|
outputPathTemplate: '${path}.json'
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
.config(function(getLinkInfo) {
|
.config(function(getLinkInfo) {
|
||||||
|
@ -27,6 +27,12 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||||||
var extraDocs = [];
|
var extraDocs = [];
|
||||||
var modules = [];
|
var modules = [];
|
||||||
|
|
||||||
|
var appDataDoc = {
|
||||||
|
id: 'app-data',
|
||||||
|
docType: 'app-data',
|
||||||
|
data: {}
|
||||||
|
};
|
||||||
|
extraDocs.push(appDataDoc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create Data for Modules
|
* Create Data for Modules
|
||||||
@ -54,7 +60,8 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||||||
var dataDoc = {
|
var dataDoc = {
|
||||||
name: exportDoc.name + '-' + exportDoc.docType,
|
name: exportDoc.name + '-' + exportDoc.docType,
|
||||||
title: exportDoc.name,
|
title: exportDoc.name,
|
||||||
docType: exportDoc.docType
|
docType: exportDoc.docType,
|
||||||
|
exportDoc: exportDoc
|
||||||
};
|
};
|
||||||
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
|
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
|
||||||
if (exportDoc.originalModule) dataDoc.originalModule = exportDoc.originalModule;
|
if (exportDoc.originalModule) dataDoc.originalModule = exportDoc.originalModule;
|
||||||
@ -63,13 +70,13 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||||||
.sortBy('name')
|
.sortBy('name')
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
|
// ADD TO APP DATA DOC
|
||||||
|
appDataDoc.data[doc.id] = modulePageInfo;
|
||||||
|
|
||||||
|
// COMBINE WITH INDEX PAGE DATA
|
||||||
|
|
||||||
//COMBINE PAGE DATA
|
|
||||||
var allPageData = indexPageInfo.concat(modulePageInfo);
|
var allPageData = indexPageInfo.concat(modulePageInfo);
|
||||||
|
|
||||||
// PUSH DATA TO EXTRA DOCS ARRAY
|
// PUSH JADE DATA DOC TO EXTRA DOCS ARRAY
|
||||||
extraDocs.push({
|
extraDocs.push({
|
||||||
id: doc.id + "-data",
|
id: doc.id + "-data",
|
||||||
aliases: [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 }}
|
h3 {{ section.title }}
|
||||||
ul.api-list
|
ul.api-list
|
||||||
li.api-item(ng-repeat='item in apiList[section.name] | filter: { title: apiFilter, docType: apiType }')
|
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 }}')
|
span(class='symbol {{ item.docType }}')
|
||||||
| {{ item.title }}
|
| {{ item.title }}
|
||||||
|
1787
public/resources/js/app-data.json
Normal file
1787
public/resources/js/app-data.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user