diff --git a/docs/README.md b/docs/README.md index 4dac070670..fa3f59caaa 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,7 +5,7 @@ First, follow these steps: https://github.com/driftyco/ionic#documentation **Templates in `templates` folder** -- `templates/pages-data.template.html` => `_layout/docs_0.9.0.html` +- `templates/pages-data.template.html` => `_layout/docs_api.html` - `templates/index.template.html` => The 'index' page for a doc version - http://ajoslin.github.io/docs/0.9.26/ - `templates/lib/yaml.template.html` => the common yaml config items that every doc page includes - `templates/api/componentGroup.template.html` => the template for every 'componentGroup' (eg http://ajoslin.github.io/docs/0.9.26/api/ionic/directive/) @@ -13,3 +13,11 @@ First, follow these steps: https://github.com/driftyco/ionic#documentation - `templates/api/{something}.template.html` - the template for {something} - eg directive.template.html for directives Not everything in all the pages is used - a lot of it is from Angular templates. Eg things like 'doc.deprecated' aren't used currently. + +**New Versions** + +Every version uses its own include for left menu, which is manually written. + +The first time a version is generated, if there is no _includes/api_menu_{{versionName}}.html, it will generate a generic one for you. + +Then you can do what you want to edit that. diff --git a/docs/docs.config.js b/docs/docs.config.js index 2c8fd31177..bcc381da6c 100644 --- a/docs/docs.config.js +++ b/docs/docs.config.js @@ -66,7 +66,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/output') ]); return config; diff --git a/docs/processors/output.js b/docs/processors/output.js new file mode 100644 index 0000000000..657e1f0e4c --- /dev/null +++ b/docs/processors/output.js @@ -0,0 +1,29 @@ +var _ = require('lodash'); +var path = require('canonical-path'); +var fs = require('fs'); + +module.exports = { + name: 'output', + description: 'log all doc urls after everything is done', + runAfter: ['files-written'], + process: function(docs, config) { + var links = docs + .filter(function(doc) { + return doc.match(/\/api\/.*?\/index.md$/) && doc.indexOf('/module/ionic') == -1; + }) + .map(function(doc) { + return doc.replace(/^.*?\/docs/,'/docs').replace(/\/index.md$/, ''); + }); + + var outputFolder = path.join(config.get('basePath'), config.get('rendering.outputFolder')); + var menuInclude = path.join(outputFolder, '_includes/api_menu_' + config.versionData.current.name + '.html'); + + if (!fs.existsSync(menuInclude)) { + fs.writeFileSync(menuInclude, links.map(function(link) { + return ''; + }).join('\n')); + } + } +}; diff --git a/docs/tag-defs/index.js b/docs/tag-defs/index.js index a359735cd8..8a603cf83d 100644 --- a/docs/tag-defs/index.js +++ b/docs/tag-defs/index.js @@ -21,11 +21,5 @@ module.exports = [ }, { name: 'alias' - }, - { - name: 'group' - }, - { - name: 'groupMainItem' } ]; diff --git a/docs/templates/lib/yaml.template.html b/docs/templates/lib/yaml.template.html index be274e61f3..18f4f592a5 100644 --- a/docs/templates/lib/yaml.template.html +++ b/docs/templates/lib/yaml.template.html @@ -1,5 +1,4 @@ -layout: docs_api +layout: "docs_api" version: "<$ version.current.name $>" versionHref: "<$ version.current.href $>" path: "<$ doc.path $>" -group: "<$ doc.group $>" diff --git a/docs/templates/pages-data.template.html b/docs/templates/pages-data.template.html index f2f11b41e2..8b034c1709 100644 --- a/docs/templates/pages-data.template.html +++ b/docs/templates/pages-data.template.html @@ -61,31 +61,7 @@ JavaScript - <@ for group in doc.groups @> - - <@ endfor @> + {% include api_menu_<$ version.current.name $>.html %}