This commit is contained in:
Tim Lancina
2015-09-08 13:49:55 -05:00
parent 6e38ba22d0
commit 3720a09500
7 changed files with 24 additions and 17 deletions

View File

@ -21,9 +21,18 @@ module.exports = function(currentVersion){
// for debugging docs // for debugging docs
// .processor(function test(){ // .processor(function test(){
// return { // return {
// $runAfter: ['readTypeScriptModules'], //
// $runAfter: ['parsing-tags'], // $runBefore: ['rendering-docs'],
// $process: function(docs){ // $process: function(docs){
// docs.forEach(function(doc){
// if (doc.members && doc.name == "IonicApp"){
// doc.members.forEach(function(method){
// if (method.name === "load") {
// console.log(method);
// }
// })
// }
// })
// } // }
// } // }
// }) // })
@ -34,7 +43,7 @@ module.exports = function(currentVersion){
.config(function(renderDocsProcessor, computePathsProcessor, versionInfo) { .config(function(renderDocsProcessor, computePathsProcessor, versionInfo) {
try { try {
versions = fs.readdirSync(path.resolve(__dirname, '../../dist/ionic-site/docs')) versions = fs.readdirSync(path.resolve(__dirname, '../../dist/ionic-site/docs/v2/'))
.filter(semver.valid) .filter(semver.valid)
} catch(e) { } catch(e) {
versions = []; versions = [];
@ -51,14 +60,12 @@ module.exports = function(currentVersion){
!_.contains(versions, 'nightly') && versions.unshift('nightly'); !_.contains(versions, 'nightly') && versions.unshift('nightly');
//First semver valid version is latest //First semver valid version is latest
var latestVersion = _.find(versions, function(v){ var latestVersion = _.find(versions, semver.valid);
return semver.valid(v) && parseInt(v) < 2 // don't let v2 docs be latest for now
});
versions = versions.map(function(version) { versions = versions.map(function(version) {
//Latest version is in docs root //Latest version is in docs root
var folder = version == latestVersion ? '' : version; var folder = version == latestVersion ? '' : version;
return { return {
href: path.join('/docs', folder), href: path.join('/docs/v2', folder),
folder: folder, folder: folder,
name: version name: version
}; };
@ -81,7 +88,7 @@ module.exports = function(currentVersion){
// remove filename since we have multiple docTypes per file // remove filename since we have multiple docTypes per file
docPath = docPath.substring(0, docPath.lastIndexOf('/') + 1); docPath = docPath.substring(0, docPath.lastIndexOf('/') + 1);
docPath += doc.name + '/index.md'; docPath += doc.name + '/index.md';
var path = 'docs/' + (versionData.current.folder || '') + var path = 'docs/v2/' + (versionData.current.folder || '') +
'/api/' + docPath; '/api/' + docPath;
return path; return path;

View File

@ -17,7 +17,7 @@ module.exports = function indexPage(renderDocsProcessor) {
id: 'index-page', id: 'index-page',
currentVersion: currentVersion, currentVersion: currentVersion,
template: 'api_index.template.html', template: 'api_index.template.html',
outputPath: 'docs/' + versionPath + '/api/index.md' outputPath: 'docs/v2/' + versionPath + '/api/index.md'
}); });
} }
} }

View File

@ -11,20 +11,20 @@ module.exports = function jekyll(renderDocsProcessor){
docType: 'api-menu', docType: 'api-menu',
id: 'api-menu', id: 'api-menu',
template: 'api_menu.template.html', template: 'api_menu.template.html',
outputPath: '_includes/api_menu.html' outputPath: '_includes/v2_api_menu.html'
}); });
//TODO autogenerate this //TODO autogenerate this
docs.push({ docs.push({
docType: 'api-menu-version', docType: 'api-menu-version',
id: 'api-menu-version', id: 'api-menu-version',
template: 'api_menu_version.template.html', template: 'api_menu_version.template.html',
outputPath: '_includes/api_menu_' + currentVersion + '.html' outputPath: '_includes/v2_api_menu_' + currentVersion + '.html'
}); });
docs.push({ docs.push({
docType: 'api-version-select', docType: 'api-version-select',
id: 'api-version-select', id: 'api-version-select',
template: 'api_version_select.template.html', template: 'api_version_select.template.html',
outputPath: '_includes/api_version_select.html' outputPath: '_includes/v2_api_version_select.html'
}); });
} }
} }

View File

@ -12,7 +12,7 @@ module.exports = function latestVersion(renderDocsProcessor) {
$process: function(docs) { $process: function(docs) {
var versionData = renderDocsProcessor.extraData.version; var versionData = renderDocsProcessor.extraData.version;
var docsBase = 'dist/ionic-site/docs'; var docsBase = 'dist/ionic-site/docs/v2/';
var versionDir = path.resolve(docsBase, versionData.latest.name); var versionDir = path.resolve(docsBase, versionData.latest.name);
var latestDir = path.resolve(docsBase, 'api'); var latestDir = path.resolve(docsBase, 'api');

View File

@ -1,5 +1,5 @@
--- ---
layout: "docs_api" layout: "v2/docs_api"
version: "<$ version.current.name $>" version: "<$ version.current.name $>"
versionHref: "<$ version.current.href $>" versionHref: "<$ version.current.href $>"
path: "" path: ""

View File

@ -5,10 +5,10 @@
<@ else @> <@ else @>
{% elsif page.versionHref == "<$ ver.href $>" %} {% elsif page.versionHref == "<$ ver.href $>" %}
<@ endif @> <@ endif @>
{% include api_menu_<$ ver.name $>.html %} {% include v2_api_menu_<$ ver.name $>.html %}
<@ endif @> <@ endif @>
<@ endfor @> <@ endfor @>
<# make the last case always be to show latest version #> <# make the last case always be to show latest version #>
{% else %} {% else %}
{% include api_menu_<$ version.latest.name $>.html %} {% include v2_api_menu_<$ version.latest.name $>.html %}
{% endif %} {% endif %}

View File

@ -1,4 +1,4 @@
layout: "docs_api" layout: "v2/docs_api"
version: "<$ version.current.name $>" version: "<$ version.current.name $>"
versionHref: "<$ version.current.href $>" versionHref: "<$ version.current.href $>"
path: "<$ doc.path $>" path: "<$ doc.path $>"