Skip to content

Commit

Permalink
refactor(docs): simplify hugely, leave more to ionic-site
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Mar 27, 2014
1 parent db74296 commit 4a7d660
Show file tree
Hide file tree
Showing 11 changed files with 458 additions and 180 deletions.
7 changes: 4 additions & 3 deletions docs/docs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ module.exports = function(config) {

config.set('processing.api-docs', {
outputPath: 'api/${docType}/${name}/index.md',
path: 'api/${docType}/${name}',
path: 'api/${docType}/${name}/',
moduleOutputPath: 'api/module/${name}/index.md',
modulePath: 'api/module/${name}'
modulePath: 'api/module/${name}/'
});

config.append('rendering.filters', [
Expand Down Expand Up @@ -61,7 +61,8 @@ module.exports = function(config) {
require('./processors/keywords'),
require('./processors/pages-data'),
require('./processors/index-page'),
require('./processors/version-data')
require('./processors/version-data'),
require('./processors/jekyll')
]);

return config;
Expand Down
7 changes: 0 additions & 7 deletions docs/processors/index-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,5 @@ module.exports = {
template: 'index.template.html',
outputPath: contentsFolder + '/api/index.md'
});
// docs.push({
// docType: 'index-page',
// id: 'index-page',
// currentVersion: currentVersion,
// template: 'index.template.html',
// outputPath: contentsFolder + '/index.md'
// });
}
};
23 changes: 23 additions & 0 deletions docs/processors/jekyll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var log = require('winston');

module.exports = {
name: 'jekyll',
runAfter: ['api-docs'],
runBefore: ['compute-path'],
description: 'Create jekyll includes',
process: function(docs, config) {
var currentVersion = config.versionData.current.name;
docs.push({
template: 'api_menu.template.html',
outputPath: '_includes/api_menu.html'
});
docs.push({
template: 'api_menu_version.template.html',
outputPath: '_includes/api_menu_' + currentVersion + '.html'
});
docs.push({
template: 'api_version_select.template.html',
outputPath: '_includes/api_version_select.html'
});
}
};
23 changes: 0 additions & 23 deletions docs/processors/pages-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,5 @@ module.exports = {
return section.name != 'directive';
})
.value();

var outputFolder = path.join(config.get('basePath'), config.get('rendering.outputFolder'));
var menuFileName = '_includes/api_menu_' + config.versionData.current.name + '.html';
var menuInclude = path.join(outputFolder, menuFileName);

if (!fs.existsSync(menuInclude)) {
docs.push({
docType: 'menu-data',
id: 'menu-data',
template: 'menu-data.template.html',
outputPath: menuFileName,
sections: sections
});
}

/*
docs.push({
docType: 'pages-data',
id: 'pages-data',
template: processorConfig.template || 'pages-data.template.js',
outputPath: processorConfig.outputPath || 'js/pages-data.js',
});
*/
}
};
14 changes: 14 additions & 0 deletions docs/templates/api_menu.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<@ for ver in version.list @>
<@ if ver.name != version.latest.name @>
<@ if loop.first @>
{% if page.versionHref == "<$ ver.href $>" %}
<@ else @>
{% elsif page.versionHref == "<$ ver.href $>" %}
<@ endif @>
{% include api_menu_<$ ver.name $>.html %}
<@ endif @>
<@ endfor @>
<# make the last case always be to show latest version #>
{% else %}
{% include api_menu_<$ version.latest.name $>.html %}
{% endif %}
Loading

0 comments on commit 4a7d660

Please sign in to comment.