2017-03-24 10:07:59 +08:00
|
|
|
"use strict";
|
2016-01-26 06:20:36 +08:00
|
|
|
module.exports = function jekyll(renderDocsProcessor) {
|
|
|
|
return {
|
|
|
|
name: 'jekyll',
|
|
|
|
description: 'Create jekyll includes',
|
|
|
|
$runAfter: ['paths-computed'],
|
|
|
|
$runBefore: ['rendering-docs'],
|
2017-03-24 10:07:59 +08:00
|
|
|
$process: docs => {
|
2017-03-24 06:20:10 +08:00
|
|
|
|
2017-03-24 10:07:59 +08:00
|
|
|
// pretty up and sort the docs object for menu generation
|
|
|
|
docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
2017-03-24 06:20:10 +08:00
|
|
|
|
2017-03-24 10:07:59 +08:00
|
|
|
docs.sort((a, b) => {
|
|
|
|
const textA = a.name ? a.name.toUpperCase() : '',
|
|
|
|
textB = b.name ? b.name.toUpperCase() : '';
|
2016-01-26 06:20:36 +08:00
|
|
|
|
|
|
|
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
|
|
|
});
|
2017-01-10 03:59:03 +08:00
|
|
|
|
2017-03-24 10:07:59 +08:00
|
|
|
docs.forEach(doc => {
|
|
|
|
doc.outputPath = doc.outputPath.toLowerCase().replace(/\s/g, '-');
|
|
|
|
doc.URL = doc.outputPath.replace('docs/v2//', 'docs/v2/')
|
|
|
|
.replace('/index.md', '')
|
|
|
|
.replace('content/', '');
|
2016-01-26 06:20:36 +08:00
|
|
|
});
|
|
|
|
|
2017-03-24 10:07:59 +08:00
|
|
|
// add side menu
|
2016-01-26 06:20:36 +08:00
|
|
|
docs.push({
|
2017-03-24 03:18:35 +08:00
|
|
|
docType: 'nativeMenu',
|
|
|
|
id: 'native_menu',
|
2016-02-06 06:04:48 +08:00
|
|
|
template: 'native_menu.template.html',
|
2016-12-17 04:59:11 +08:00
|
|
|
outputPath: 'content/_includes/v2_fluid/native_menu.html'
|
2016-01-26 06:20:36 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
return docs;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|