diff --git a/scripts/docs/dgeni-config.js b/scripts/docs/dgeni-config.js index 9b50ab7029..833b824b58 100644 --- a/scripts/docs/dgeni-config.js +++ b/scripts/docs/dgeni-config.js @@ -10,6 +10,7 @@ var path = require('path'); module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage]) .processor(require('./processors/index-page')) +.processor(require('./processors/jekyll')) // for debugging docs // .processor(function test(){ @@ -68,9 +69,21 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty // Nunjucks and Angular conflict in their template bindings so change the Nunjucks templateEngine.config.tags = { variableStart: '{$', - variableEnd: '$}' + variableEnd: '$}', + blockStart: '<@', + blockEnd: '@>' }; + //Don't conflict with the jekyll tags + // config.set('rendering.nunjucks.config.tags', { + // blockStart: '<@', + // blockEnd: '@>', + // variableStart: '<$', + // variableEnd: '$>', + // commentStart: '<#', + // commentEnd: '#>' + // }); + templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates')); // Specify how to match docs to templates. diff --git a/scripts/docs/processors/jekyll.js b/scripts/docs/processors/jekyll.js index 05efd58e2f..7f452b8ee4 100644 --- a/scripts/docs/processors/jekyll.js +++ b/scripts/docs/processors/jekyll.js @@ -1,23 +1,31 @@ -var log = require('winston'); +module.exports = function jekyll(){ + return { + name: 'jekyll', + description: 'Create jekyll includes', + $runAfter: ['adding-extra-docs'], + $runBefore: ['extra-docs-added'], + $process: function(docs) { + //TODO(tlancina): supply this via DI + var currentVersion = '2.0.0-alpha.2'; -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' - }); + docs.push({ + docType: 'api-menu', + id: 'api-menu', + template: 'api_menu.template.html', + outputPath: '_includes/api_menu.html' + }); + docs.push({ + docType: 'api-menu-version', + id: 'api-menu-version', + template: 'api_menu_version.template.html', + outputPath: '_includes/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' + }); + } } }; diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index 58df91ed04..9caa68f781 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -1,51 +1,51 @@ -{% macro paramList(paramData) -%} - {%- if paramData -%}( - {%- for param in paramData -%} - {$ param | escape $}{% if not loop.last %}, {% endif %} - {%- endfor %}) - {%- endif %} -{%- endmacro -%} -{% macro githubViewLink(doc) -%} +<@ macro paramList(paramData) -@> + <@- if paramData -@>( + <@- for param in paramData -@> + {$ param | escape $}<@ if not loop.last @>, <@ endif @> + <@- endfor @>) + <@- endif @> +<@- endmacro -@> +<@ macro githubViewLink(doc) -@> {$ doc.fileInfo.relativePath $} (line {$ doc.location.start.line+1 $}) -{%- endmacro -%} +<@- endmacro -@> -{% block body %} +<@ block body @>
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
defined in {$ githubViewLink(doc) $}
{$ doc.description | marked $}
-{%- if doc.decorators %} +<@- if doc.decorators @>