mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
docs generation for new docs site
This commit is contained in:
@ -1,31 +1,47 @@
|
|||||||
module.exports = function jekyll(renderDocsProcessor){
|
module.exports = function jekyll(renderDocsProcessor) {
|
||||||
return {
|
return {
|
||||||
name: 'jekyll',
|
name: 'jekyll',
|
||||||
description: 'Create jekyll includes',
|
description: 'Create jekyll includes',
|
||||||
$runAfter: ['adding-extra-docs'],
|
$runAfter: ['paths-computed'],
|
||||||
$runBefore: ['extra-docs-added'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: function(docs) {
|
$process: function(docs) {
|
||||||
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
||||||
|
|
||||||
|
// pretty up and sort the docs object for menu generation
|
||||||
|
docs = docs.filter(function(doc) {
|
||||||
|
return !!doc.name && !!doc.outputPath;
|
||||||
|
});
|
||||||
|
docs.sort(function(a, b) {
|
||||||
|
textA = a.name ? a.name.toUpperCase() : '';
|
||||||
|
textB = b.name ? b.name.toUpperCase() : '';
|
||||||
|
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
||||||
|
});
|
||||||
|
docs.forEach(function(doc, i) {
|
||||||
|
docs[i].URL = doc.outputPath.replace('docs/v2//','docs/v2/')
|
||||||
|
.replace('/index.md','');
|
||||||
|
});
|
||||||
|
|
||||||
docs.push({
|
docs.push({
|
||||||
docType: 'api-menu',
|
docType: 'api-menu',
|
||||||
id: 'api-menu',
|
id: 'api-menu',
|
||||||
template: 'api_menu.template.html',
|
template: 'api_menu.template.html',
|
||||||
outputPath: '_includes/v2/api_menu.html'
|
outputPath: '_includes/v2_fluid/api_menu.html'
|
||||||
});
|
});
|
||||||
//TODO autogenerate this
|
|
||||||
docs.push({
|
docs.push({
|
||||||
docType: 'api-menu-version',
|
docType: 'api-menu-flat-version',
|
||||||
id: 'api-menu-version',
|
id: 'api-menu-flat-version',
|
||||||
template: 'api_menu_version.template.html',
|
template: 'api_menu_flat_version.template.html',
|
||||||
outputPath: '_includes/v2/api_menu_' + currentVersion + '.html'
|
outputPath: '_includes/v2_fluid/api_menu_flat_' + currentVersion + '.html'
|
||||||
});
|
});
|
||||||
docs.push({
|
docs.push({
|
||||||
docType: 'api-version-select',
|
docType: 'api-version-select',
|
||||||
id: 'api-version-select',
|
id: 'api-version-select',
|
||||||
template: 'api_version_select.template.html',
|
template: 'api_version_select.template.html',
|
||||||
outputPath: '_includes/v2/api_version_select.html'
|
outputPath: '_includes/v2_fluid/api_version_select.html'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// returning docs will replace docs object in the next process
|
||||||
|
return docs;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
layout: "v2/docs_base"
|
layout: "v2_fluid/docs_base"
|
||||||
version: "<$ version.current.name $>"
|
version: "<$ version.current.name $>"
|
||||||
versionHref: "<$ version.current.href $>"
|
versionHref: "<$ version.current.href $>"
|
||||||
path: ""
|
path: ""
|
||||||
|
|
||||||
|
category: api
|
||||||
id: api
|
id: api
|
||||||
title: Javascript
|
title: Javascript
|
||||||
header_sub_title: Extend Ionic even further with the power of AngularJS
|
header_sub_title: Extend Ionic even further with the power of AngularJS
|
||||||
|
4
scripts/docs/templates/api_menu_flat_version.template.html
vendored
Normal file
4
scripts/docs/templates/api_menu_flat_version.template.html
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<@ for doc in docs @><@ if doc.URL @>
|
||||||
|
<li class="{% if page.id == '{{<$ doc.name $> | slugify: 'pretty'}}' %}active{% endif %}">
|
||||||
|
<a href="<$ doc.URL $>"><$ doc.name $></a>
|
||||||
|
</li><@ endif @><@ endfor @>
|
@ -1,4 +1,4 @@
|
|||||||
<select onchange="window.location.href=this.options[this.selectedIndex].value">
|
<select name="version" id="version-toggle">
|
||||||
<@ for ver in version.list @>
|
<@ for ver in version.list @>
|
||||||
<option
|
<option
|
||||||
value="<$ ver.href $>/{% if page.path != ''%}{{page.path}}{% else %}api/{% endif %}"
|
value="<$ ver.href $>/{% if page.path != ''%}{{page.path}}{% else %}api/{% endif %}"
|
||||||
@ -7,5 +7,3 @@
|
|||||||
</option>
|
</option>
|
||||||
<@ endfor @>
|
<@ endfor @>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
5
scripts/docs/templates/common.template.html
vendored
5
scripts/docs/templates/common.template.html
vendored
@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
layout: "v2/docs_base"
|
layout: "v2_fluid/docs_base"
|
||||||
version: "<$ version.current.name $>"
|
version: "<$ version.current.name $>"
|
||||||
versionHref: "<$ version.current.href $>"
|
versionHref: "<$ version.current.href $>"
|
||||||
path: "<$ doc.path $>"
|
path: "<$ doc.path $>"
|
||||||
id: api
|
category: api
|
||||||
|
id: "{{<$ doc.name $> | slugify: 'pretty'}}"
|
||||||
title: "<@ if doc.docType == "directive" @><$ doc.name | dashCase $><@ else @><$ doc.name $><@ endif @>"
|
title: "<@ if doc.docType == "directive" @><$ doc.name | dashCase $><@ else @><$ doc.name $><@ endif @>"
|
||||||
header_sub_title: "<$ doc.docType | capital $> in module <$ doc.module $>"
|
header_sub_title: "<$ doc.docType | capital $> in module <$ doc.module $>"
|
||||||
doc: "<$ doc.name $>"
|
doc: "<$ doc.name $>"
|
||||||
|
Reference in New Issue
Block a user