diff --git a/docs/docs.config.js b/docs/docs.config.js index 917abdd910..b29e3f3982 100644 --- a/docs/docs.config.js +++ b/docs/docs.config.js @@ -27,9 +27,9 @@ module.exports = function(config) { config.set('processing.api-docs', { outputPath: 'api/${docType}/${name}/index.md', - path: 'api/${docType}/${name}', + path: 'api/${docType}/${name}/', moduleOutputPath: 'api/module/${name}/index.md', - modulePath: 'api/module/${name}' + modulePath: 'api/module/${name}/' }); config.append('rendering.filters', [ @@ -61,7 +61,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/jekyll') ]); return config; diff --git a/docs/processors/index-page.js b/docs/processors/index-page.js index db1b41e146..ed770ef83c 100644 --- a/docs/processors/index-page.js +++ b/docs/processors/index-page.js @@ -20,12 +20,5 @@ module.exports = { template: 'index.template.html', outputPath: contentsFolder + '/api/index.md' }); - // docs.push({ - // docType: 'index-page', - // id: 'index-page', - // currentVersion: currentVersion, - // template: 'index.template.html', - // outputPath: contentsFolder + '/index.md' - // }); } }; diff --git a/docs/processors/jekyll.js b/docs/processors/jekyll.js new file mode 100644 index 0000000000..05efd58e2f --- /dev/null +++ b/docs/processors/jekyll.js @@ -0,0 +1,23 @@ +var log = require('winston'); + +module.exports = { + name: 'jekyll', + runAfter: ['api-docs'], + runBefore: ['compute-path'], + description: 'Create jekyll includes', + process: function(docs, config) { + var currentVersion = config.versionData.current.name; + docs.push({ + template: 'api_menu.template.html', + outputPath: '_includes/api_menu.html' + }); + docs.push({ + template: 'api_menu_version.template.html', + outputPath: '_includes/api_menu_' + currentVersion + '.html' + }); + docs.push({ + template: 'api_version_select.template.html', + outputPath: '_includes/api_version_select.html' + }); + } +}; diff --git a/docs/processors/pages-data.js b/docs/processors/pages-data.js index 23d8fc9dd3..bb24870e68 100644 --- a/docs/processors/pages-data.js +++ b/docs/processors/pages-data.js @@ -52,28 +52,5 @@ module.exports = { return section.name != 'directive'; }) .value(); - - var outputFolder = path.join(config.get('basePath'), config.get('rendering.outputFolder')); - var menuFileName = '_includes/api_menu_' + config.versionData.current.name + '.html'; - var menuInclude = path.join(outputFolder, menuFileName); - - if (!fs.existsSync(menuInclude)) { - docs.push({ - docType: 'menu-data', - id: 'menu-data', - template: 'menu-data.template.html', - outputPath: menuFileName, - sections: sections - }); - } - - /* - docs.push({ - docType: 'pages-data', - id: 'pages-data', - template: processorConfig.template || 'pages-data.template.js', - outputPath: processorConfig.outputPath || 'js/pages-data.js', - }); - */ } }; diff --git a/docs/templates/api_menu.template.html b/docs/templates/api_menu.template.html new file mode 100644 index 0000000000..3751ab3e7e --- /dev/null +++ b/docs/templates/api_menu.template.html @@ -0,0 +1,14 @@ +<@ for ver in version.list @> + <@ if ver.name != version.latest.name @> + <@ if loop.first @> +{% if page.versionHref == "<$ ver.href $>" %} + <@ else @> +{% elsif page.versionHref == "<$ ver.href $>" %} + <@ endif @> + {% include 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 %} +{% endif %} diff --git a/docs/templates/api_menu_version.template.html b/docs/templates/api_menu_version.template.html new file mode 100644 index 0000000000..67175d2622 --- /dev/null +++ b/docs/templates/api_menu_version.template.html @@ -0,0 +1,406 @@ + +