From 786d371edc3c20805027a08febbfb9c514923d18 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Tue, 1 Sep 2015 11:50:16 -0500 Subject: [PATCH] have doc paths use version --- scripts/docs/dgeni-config.js | 62 +++++++++++---------- scripts/docs/templates/module.template.html | 2 +- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/scripts/docs/dgeni-config.js b/scripts/docs/dgeni-config.js index 1861b57b92..957b126f57 100644 --- a/scripts/docs/dgeni-config.js +++ b/scripts/docs/dgeni-config.js @@ -12,13 +12,9 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty // for debugging docs // .processor(function test(){ // return { -// $runAfter: ['files-written'], +// $runAfter: ['readTypeScriptModules'], +// $runAfter: ['parsing-tags'], // $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 -.config(function(writeFilesProcessor) { - writeFilesProcessor.outputFolder = 'dist/docs'; +.config(function(writeFilesProcessor, versionInfo) { + // TODO(tlancina): Use nightly if version isn't specified by gulp task + writeFilesProcessor.outputFolder = 'dist/ionic-site/docs/' + versionInfo.currentVersion.raw + '/api/'; }) // Configure rendering @@ -91,24 +88,31 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty }) // Configure ids and paths -// .config(function(computeIdsProcessor, computePathsProcessor) { -// computeIdsProcessor.idTemplates.push({ -// docTypes: ['guide'], -// getId: function(doc) { -// return doc.fileInfo.relativePath -// // path should be relative to `modules` folder -// .replace(/.*\/?modules\//, '') -// // path should not include `/docs/` -// .replace(/\/docs\//, '/') -// // path should not have a suffix -// .replace(/\.\w*$/, ''); -// }, -// getAliases: function(doc) { return [doc.id]; } -// }); -// -// computePathsProcessor.pathTemplates.push({ -// docTypes: ['guide'], -// pathTemplate: '/${id}', -// outputPathTemplate: 'partials/guides/${id}.html' -// }); -// }); +.config(function(computeIdsProcessor, computePathsProcessor, versionInfo) { + // computeIdsProcessor.idTemplates.push({ + // docTypes: ['guide'], + // getId: function(doc) { + // return doc.fileInfo.relativePath + // // path should be relative to `modules` folder + // .replace(/.*\/?modules\//, '') + // // path should not include `/docs/` + // .replace(/\/docs\//, '/') + // // path should not have a suffix + // .replace(/\.\w*$/, ''); + // }, + // getAliases: function(doc) { return [doc.id]; } + // }); + + // docTypes: 'module', 'member', 'class', 'var', 'function', 'let' + + computePathsProcessor.pathTemplates = [{ + 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'); + } + }]; +}); diff --git a/scripts/docs/templates/module.template.html b/scripts/docs/templates/module.template.html index 73f0a6788b..3d6df9c716 100644 --- a/scripts/docs/templates/module.template.html +++ b/scripts/docs/templates/module.template.html @@ -1,5 +1,5 @@

{$ doc.id $}

{%- for export in doc.exports %} - {$ export.name $}
+ {$ export.name $}
{% endfor %}