mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
add api menu templates
This commit is contained in:
@ -10,6 +10,7 @@ var path = require('path');
|
|||||||
module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage])
|
module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage])
|
||||||
|
|
||||||
.processor(require('./processors/index-page'))
|
.processor(require('./processors/index-page'))
|
||||||
|
.processor(require('./processors/jekyll'))
|
||||||
|
|
||||||
// for debugging docs
|
// for debugging docs
|
||||||
// .processor(function test(){
|
// .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
|
// Nunjucks and Angular conflict in their template bindings so change the Nunjucks
|
||||||
templateEngine.config.tags = {
|
templateEngine.config.tags = {
|
||||||
variableStart: '{$',
|
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'));
|
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
|
||||||
|
|
||||||
// Specify how to match docs to templates.
|
// Specify how to match docs to templates.
|
||||||
|
@ -1,23 +1,31 @@
|
|||||||
var log = require('winston');
|
module.exports = function jekyll(){
|
||||||
|
return {
|
||||||
module.exports = {
|
|
||||||
name: 'jekyll',
|
name: 'jekyll',
|
||||||
runAfter: ['api-docs'],
|
|
||||||
runBefore: ['compute-path'],
|
|
||||||
description: 'Create jekyll includes',
|
description: 'Create jekyll includes',
|
||||||
process: function(docs, config) {
|
$runAfter: ['adding-extra-docs'],
|
||||||
var currentVersion = config.versionData.current.name;
|
$runBefore: ['extra-docs-added'],
|
||||||
|
$process: function(docs) {
|
||||||
|
//TODO(tlancina): supply this via DI
|
||||||
|
var currentVersion = '2.0.0-alpha.2';
|
||||||
|
|
||||||
docs.push({
|
docs.push({
|
||||||
|
docType: 'api-menu',
|
||||||
|
id: 'api-menu',
|
||||||
template: 'api_menu.template.html',
|
template: 'api_menu.template.html',
|
||||||
outputPath: '_includes/api_menu.html'
|
outputPath: '_includes/api_menu.html'
|
||||||
});
|
});
|
||||||
docs.push({
|
docs.push({
|
||||||
|
docType: 'api-menu-version',
|
||||||
|
id: 'api-menu-version',
|
||||||
template: 'api_menu_version.template.html',
|
template: 'api_menu_version.template.html',
|
||||||
outputPath: '_includes/api_menu_' + currentVersion + '.html'
|
outputPath: '_includes/api_menu_' + currentVersion + '.html'
|
||||||
});
|
});
|
||||||
docs.push({
|
docs.push({
|
||||||
|
docType: 'api-version-select',
|
||||||
|
id: 'api-version-select',
|
||||||
template: 'api_version_select.template.html',
|
template: 'api_version_select.template.html',
|
||||||
outputPath: '_includes/api_version_select.html'
|
outputPath: '_includes/api_version_select.html'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
52
scripts/docs/templates/common.template.html
vendored
52
scripts/docs/templates/common.template.html
vendored
@ -1,51 +1,51 @@
|
|||||||
{% macro paramList(paramData) -%}
|
<@ macro paramList(paramData) -@>
|
||||||
{%- if paramData -%}<span class="params">(
|
<@- if paramData -@><span class="params">(
|
||||||
{%- for param in paramData -%}
|
<@- for param in paramData -@>
|
||||||
<span class="param">{$ param | escape $}{% if not loop.last %}, {% endif %}</span>
|
<span class="param">{$ param | escape $}<@ if not loop.last @>, <@ endif @></span>
|
||||||
{%- endfor %})</span>
|
<@- endfor @>)</span>
|
||||||
{%- endif %}
|
<@- endif @>
|
||||||
{%- endmacro -%}
|
<@- endmacro -@>
|
||||||
{% macro githubViewLink(doc) -%}
|
<@ macro githubViewLink(doc) -@>
|
||||||
<a href="https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/master/{$ doc.fileInfo.relativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}">{$ doc.fileInfo.relativePath $} (line {$ doc.location.start.line+1 $})</a>
|
<a href="https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/master/{$ doc.fileInfo.relativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}">{$ doc.fileInfo.relativePath $} (line {$ doc.location.start.line+1 $})</a>
|
||||||
{%- endmacro -%}
|
<@- endmacro -@>
|
||||||
|
|
||||||
{% block body %}
|
<@ block body @>
|
||||||
<h1 class="class export">{$ doc.name $} <span class="type">{$ doc.docType $}</span></h1>
|
<h1 class="class export">{$ doc.name $} <span class="type">{$ doc.docType $}</span></h1>
|
||||||
<p class="module">exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }<br/>
|
<p class="module">exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }<br/>
|
||||||
defined in {$ githubViewLink(doc) $}
|
defined in {$ githubViewLink(doc) $}
|
||||||
</p>
|
</p>
|
||||||
<p>{$ doc.description | marked $}</p>
|
<p>{$ doc.description | marked $}</p>
|
||||||
|
|
||||||
{%- if doc.decorators %}
|
<@- if doc.decorators @>
|
||||||
<h2>Annotations</h2>
|
<h2>Annotations</h2>
|
||||||
{%- for decorator in doc.decorators %}
|
<@- for decorator in doc.decorators @>
|
||||||
<h3 class="annotation">@{$ decorator.name $}{$ paramList(decorator.arguments) $}</h3>
|
<h3 class="annotation">@{$ decorator.name $}{$ paramList(decorator.arguments) $}</h3>
|
||||||
{% endfor %}
|
<@ endfor @>
|
||||||
{% endif -%}
|
<@ endif -@>
|
||||||
|
|
||||||
{%- if doc.constructorDoc or doc.members.length -%}
|
<@- if doc.constructorDoc or doc.members.length -@>
|
||||||
<h2>Members</h2>
|
<h2>Members</h2>
|
||||||
|
|
||||||
{%- if doc.constructorDoc %}
|
<@- if doc.constructorDoc @>
|
||||||
<section class="member constructor">
|
<section class="member constructor">
|
||||||
<h1 id="constructor" class="name">{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.paramData) $}</h1>
|
<h1 id="constructor" class="name">{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.paramData) $}</h1>
|
||||||
{% marked %}
|
<@ marked @>
|
||||||
{$ doc.constructorDoc.description $}
|
{$ doc.constructorDoc.description $}
|
||||||
{% endmarked %}
|
<@ endmarked @>
|
||||||
</section>
|
</section>
|
||||||
{% endif -%}
|
<@ endif -@>
|
||||||
|
|
||||||
{%- for member in doc.members %}{% if not member.private %}
|
<@- for member in doc.members @><@ if not member.private @>
|
||||||
<section class="member">
|
<section class="member">
|
||||||
<h1 id="{$ member.name $}" class="name">
|
<h1 id="{$ member.name $}" class="name">
|
||||||
{$ member.name $}{% if member.optional %}?{% endif %}{$ paramList(member.params) $}
|
{$ member.name $}<@ if member.optional @>?<@ endif @>{$ paramList(member.params) $}
|
||||||
</h1>
|
</h1>
|
||||||
{% marked %}
|
<@ marked @>
|
||||||
{$ member.description $}
|
{$ member.description $}
|
||||||
{% endmarked %}
|
<@ endmarked @>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% endif %}{% endfor %}
|
<@ endif @><@ endfor @>
|
||||||
{%- endif -%}
|
<@- endif -@>
|
||||||
|
|
||||||
{% endblock %}
|
<@ endblock @>
|
||||||
|
Reference in New Issue
Block a user