mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
docs generation for new docs site
This commit is contained in:
@ -1,31 +1,47 @@
|
||||
module.exports = function jekyll(renderDocsProcessor){
|
||||
module.exports = function jekyll(renderDocsProcessor) {
|
||||
return {
|
||||
name: 'jekyll',
|
||||
description: 'Create jekyll includes',
|
||||
$runAfter: ['adding-extra-docs'],
|
||||
$runBefore: ['extra-docs-added'],
|
||||
$runAfter: ['paths-computed'],
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
||||
|
||||
// pretty up and sort the docs object for menu generation
|
||||
docs = docs.filter(function(doc) {
|
||||
return !!doc.name && !!doc.outputPath;
|
||||
});
|
||||
docs.sort(function(a, b) {
|
||||
textA = a.name ? a.name.toUpperCase() : '';
|
||||
textB = b.name ? b.name.toUpperCase() : '';
|
||||
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
||||
});
|
||||
docs.forEach(function(doc, i) {
|
||||
docs[i].URL = doc.outputPath.replace('docs/v2//','docs/v2/')
|
||||
.replace('/index.md','');
|
||||
});
|
||||
|
||||
docs.push({
|
||||
docType: 'api-menu',
|
||||
id: 'api-menu',
|
||||
template: 'api_menu.template.html',
|
||||
outputPath: '_includes/v2/api_menu.html'
|
||||
outputPath: '_includes/v2_fluid/api_menu.html'
|
||||
});
|
||||
//TODO autogenerate this
|
||||
docs.push({
|
||||
docType: 'api-menu-version',
|
||||
id: 'api-menu-version',
|
||||
template: 'api_menu_version.template.html',
|
||||
outputPath: '_includes/v2/api_menu_' + currentVersion + '.html'
|
||||
docType: 'api-menu-flat-version',
|
||||
id: 'api-menu-flat-version',
|
||||
template: 'api_menu_flat_version.template.html',
|
||||
outputPath: '_includes/v2_fluid/api_menu_flat_' + currentVersion + '.html'
|
||||
});
|
||||
docs.push({
|
||||
docType: 'api-version-select',
|
||||
id: 'api-version-select',
|
||||
template: 'api_version_select.template.html',
|
||||
outputPath: '_includes/v2/api_version_select.html'
|
||||
outputPath: '_includes/v2_fluid/api_version_select.html'
|
||||
});
|
||||
|
||||
// returning docs will replace docs object in the next process
|
||||
return docs;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user