have doc paths use version

This commit is contained in:
Tim Lancina
2015-09-01 11:50:16 -05:00
parent 3e516dce46
commit 786d371edc
2 changed files with 34 additions and 30 deletions

View File

@ -12,13 +12,9 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty
// for debugging docs // for debugging docs
// .processor(function test(){ // .processor(function test(){
// return { // return {
// $runAfter: ['files-written'], // $runAfter: ['readTypeScriptModules'],
// $runAfter: ['parsing-tags'],
// $process: function(docs){ // $process: function(docs){
// docs.forEach(function(doc){
// if (doc.constructorDoc){
// debugger;
// }
// })
// } // }
// } // }
// }) // })
@ -59,8 +55,9 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty
}) })
// Configure file writing // Configure file writing
.config(function(writeFilesProcessor) { .config(function(writeFilesProcessor, versionInfo) {
writeFilesProcessor.outputFolder = 'dist/docs'; // TODO(tlancina): Use nightly if version isn't specified by gulp task
writeFilesProcessor.outputFolder = 'dist/ionic-site/docs/' + versionInfo.currentVersion.raw + '/api/';
}) })
// Configure rendering // Configure rendering
@ -91,7 +88,7 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty
}) })
// Configure ids and paths // Configure ids and paths
// .config(function(computeIdsProcessor, computePathsProcessor) { .config(function(computeIdsProcessor, computePathsProcessor, versionInfo) {
// computeIdsProcessor.idTemplates.push({ // computeIdsProcessor.idTemplates.push({
// docTypes: ['guide'], // docTypes: ['guide'],
// getId: function(doc) { // getId: function(doc) {
@ -105,10 +102,17 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty
// }, // },
// getAliases: function(doc) { return [doc.id]; } // getAliases: function(doc) { return [doc.id]; }
// }); // });
//
// computePathsProcessor.pathTemplates.push({ // docTypes: 'module', 'member', 'class', 'var', 'function', 'let'
// docTypes: ['guide'],
// pathTemplate: '/${id}', computePathsProcessor.pathTemplates = [{
// outputPathTemplate: 'partials/guides/${id}.html' docTypes: ['class', 'var', 'function', 'let'],
// }); getOutputPath: function(doc) {
// }); return doc.fileInfo.relativePath
// strip ionic from path root
.replace(/^ionic\//, '')
// replace extension with .html
.replace(/\.\w*$/, '.html');
}
}];
});

View File

@ -1,5 +1,5 @@
<h1>{$ doc.id $}</h1> <h1>{$ doc.id $}</h1>
{%- for export in doc.exports %} {%- for export in doc.exports %}
<a href="/docs/{$ export.outputPath $}">{$ export.name $}</a></br> <a href="/ionic-site/docs/{$ export.outputPath $}">{$ export.name $}</a></br>
{% endfor %} {% endfor %}