mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
v2 docs
This commit is contained in:
@ -21,9 +21,18 @@ module.exports = function(currentVersion){
|
||||
// for debugging docs
|
||||
// .processor(function test(){
|
||||
// return {
|
||||
// $runAfter: ['readTypeScriptModules'],
|
||||
// $runAfter: ['parsing-tags'],
|
||||
//
|
||||
// $runBefore: ['rendering-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) {
|
||||
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)
|
||||
} catch(e) {
|
||||
versions = [];
|
||||
@ -51,14 +60,12 @@ module.exports = function(currentVersion){
|
||||
!_.contains(versions, 'nightly') && versions.unshift('nightly');
|
||||
|
||||
//First semver valid version is latest
|
||||
var latestVersion = _.find(versions, function(v){
|
||||
return semver.valid(v) && parseInt(v) < 2 // don't let v2 docs be latest for now
|
||||
});
|
||||
var latestVersion = _.find(versions, semver.valid);
|
||||
versions = versions.map(function(version) {
|
||||
//Latest version is in docs root
|
||||
var folder = version == latestVersion ? '' : version;
|
||||
return {
|
||||
href: path.join('/docs', folder),
|
||||
href: path.join('/docs/v2', folder),
|
||||
folder: folder,
|
||||
name: version
|
||||
};
|
||||
@ -81,7 +88,7 @@ module.exports = function(currentVersion){
|
||||
// remove filename since we have multiple docTypes per file
|
||||
docPath = docPath.substring(0, docPath.lastIndexOf('/') + 1);
|
||||
docPath += doc.name + '/index.md';
|
||||
var path = 'docs/' + (versionData.current.folder || '') +
|
||||
var path = 'docs/v2/' + (versionData.current.folder || '') +
|
||||
'/api/' + docPath;
|
||||
|
||||
return path;
|
||||
|
@ -17,7 +17,7 @@ module.exports = function indexPage(renderDocsProcessor) {
|
||||
id: 'index-page',
|
||||
currentVersion: currentVersion,
|
||||
template: 'api_index.template.html',
|
||||
outputPath: 'docs/' + versionPath + '/api/index.md'
|
||||
outputPath: 'docs/v2/' + versionPath + '/api/index.md'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -11,20 +11,20 @@ module.exports = function jekyll(renderDocsProcessor){
|
||||
docType: 'api-menu',
|
||||
id: 'api-menu',
|
||||
template: 'api_menu.template.html',
|
||||
outputPath: '_includes/api_menu.html'
|
||||
outputPath: '_includes/v2_api_menu.html'
|
||||
});
|
||||
//TODO autogenerate this
|
||||
docs.push({
|
||||
docType: 'api-menu-version',
|
||||
id: 'api-menu-version',
|
||||
template: 'api_menu_version.template.html',
|
||||
outputPath: '_includes/api_menu_' + currentVersion + '.html'
|
||||
outputPath: '_includes/v2_api_menu_' + currentVersion + '.html'
|
||||
});
|
||||
docs.push({
|
||||
docType: 'api-version-select',
|
||||
id: 'api-version-select',
|
||||
template: 'api_version_select.template.html',
|
||||
outputPath: '_includes/api_version_select.html'
|
||||
outputPath: '_includes/v2_api_version_select.html'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ module.exports = function latestVersion(renderDocsProcessor) {
|
||||
$process: function(docs) {
|
||||
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 latestDir = path.resolve(docsBase, 'api');
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
layout: "docs_api"
|
||||
layout: "v2/docs_api"
|
||||
version: "<$ version.current.name $>"
|
||||
versionHref: "<$ version.current.href $>"
|
||||
path: ""
|
||||
|
@ -5,10 +5,10 @@
|
||||
<@ else @>
|
||||
{% elsif page.versionHref == "<$ ver.href $>" %}
|
||||
<@ endif @>
|
||||
{% include api_menu_<$ ver.name $>.html %}
|
||||
{% include v2_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 %}
|
||||
{% include v2_api_menu_<$ version.latest.name $>.html %}
|
||||
{% endif %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
layout: "docs_api"
|
||||
layout: "v2/docs_api"
|
||||
version: "<$ version.current.name $>"
|
||||
versionHref: "<$ version.current.href $>"
|
||||
path: "<$ doc.path $>"
|
||||
|
Reference in New Issue
Block a user