generate api index page

This commit is contained in:
Tim Lancina
2015-09-01 15:07:00 -05:00
parent 481fd7f651
commit d0c9f1404e
28 changed files with 1183 additions and 1 deletions

View File

@ -9,6 +9,8 @@ var path = require('path');
// Define the dgeni package for generating the docs
module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage])
.processor(require('./processors/index-page'))
// for debugging docs
// .processor(function test(){
// return {
@ -74,6 +76,7 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty
// Specify how to match docs to templates.
// In this case we just use the same static template for all docs
templateFinder.templatePatterns = [
'${ doc.template }',
'${ doc.docType }.template.html',
'common.template.html'
]
@ -88,7 +91,7 @@ module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, ty
})
// Configure ids and paths
.config(function(computeIdsProcessor, computePathsProcessor, versionInfo) {
.config(function(computeIdsProcessor, computePathsProcessor) {
// computeIdsProcessor.idTemplates.push({
// docTypes: ['guide'],
// getId: function(doc) {

View File

@ -0,0 +1,18 @@
module.exports = function indexPage() {
return {
name: 'index-page',
description: 'Create documentation index page',
version: 'nightly',
$runAfter: ['adding-extra-docs'],
$runBefore: ['extra-docs-added'],
$process: function(docs) {
docs.push({
docType: 'index-page',
id: 'index-page',
currentVersion: this.version,
template: 'api_index.template.html',
outputPath: 'index.md'
});
}
}
};

View File

@ -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'
});
}
};

View File

@ -0,0 +1,30 @@
var copy = require('cpr').cpr;
var mkdirp = require('mkdirp');
var path = require('canonical-path');
var q = require('q');
module.exports = {
name: 'latest-version',
runAfter: ['write-files'],
description: 'Copy the latest version (that was compiled to docs/) into docs/versionName',
process: function(docs, config) {
var versionData = config.get('versionData');
var docsBase = path.join(config.get('rendering.outputFolder'), 'docs');
var versionDir = path.join(docsBase, versionData.latest.name);
var latestDir = path.join(docsBase, 'api');
var deferred = q.defer();
mkdirp(versionDir, function() {
copy(latestDir, path.join(versionDir, 'api'), {
deleteFirst: true,
overwrite: true
}, function(err, files) {
deferred.resolve(docs);
});
});
return deferred.promise;
}
};

View File

@ -0,0 +1,52 @@
var _ = require('lodash');
var fs = require('fs');
var semver = require('semver');
var path = require('canonical-path');
module.exports = {
name: 'version-data',
runBefore: ['reading-files'],
description: 'Expose version data to templates',
process: function(extraData, config) {
var basePath = config.get('basePath');
var outputFolder = config.get('rendering.outputFolder');
var currentVersion = config.get('currentVersion');
var docsBaseFolder = path.resolve(basePath, outputFolder, 'docs');
var versions;
try {
versions = fs.readdirSync(docsBaseFolder)
.filter(semver.valid)
.sort(semver.rcompare);
} catch(e) {
versions = [];
}
!_.contains(versions, currentVersion) && versions.unshift(currentVersion);
!_.contains(versions, 'nightly') && versions.unshift('nightly');
//First semver valid version is latest
var latestVersion = _.find(versions, semver.valid);
versions = versions.map(function(version) {
//Latest version is in docs root
var folder = version == latestVersion ? '' : version;
return {
href: path.join('/', config.get('versionFolderBase') || '', folder),
folder: folder,
name: version
};
});
var versionData = {
list: versions,
current: _.find(versions, { name: currentVersion }),
latest: _.find(versions, {name: latestVersion}) || _.first(versions)
};
config.set('rendering.contentsFolder',
path.join(config.get('versionFolderBase') || '', versionData.current.folder || ''));
config.set('versionData', versionData);
extraData.version = versionData;
}
};

View File

@ -0,0 +1,79 @@
---
<@ include "lib/yaml.template.html" @>
title: "<@ if doc.docType == "directive" @><$ doc.name | dashCase $><@ else @><$ doc.name $><@ endif @>"
header_sub_title: "<$ doc.docType | capital $> in module <$ doc.module $>"
doc: "<$ doc.name $>"
docType: "<$ doc.docType $>"
---
<div class="improve-docs">
<a href='http://github.com/driftyco/ionic/tree/master/<$ doc.relativePath $>#L<$ doc.startingLine $>'>
View Source
</a>
&nbsp;
<a href='http://github.com/driftyco/ionic/edit/master/<$ doc.relativePath $>#L<$ doc.startingLine $>'>
Improve this doc
</a>
</div>
<@ block content @>
<@ block header @>
<h1 class="api-title">
<@ if doc.docType == "directive" @>
<$ doc.name | dashCase $>
<@ else @>
<$ doc.name $>
<@ endif @>
<@ if doc.parent @>
<br />
<small>
Child of <$ doc.parent $>
</small>
<@ endif @>
<@ if doc.delegate @>
<br/>
<small>
Delegate: <$ doc.delegate $>
</small>
<@ endif @>
</h1>
<@ if doc.codepen @>
{% include codepen.html id="<$ doc.codepen $>" %}
<@ endif @>
<@ endblock @>
<@ block description @>
<$ doc.description $>
<@ endblock @>
<@ if doc.deprecated @>
<fieldset class="deprecated">
<legend>Deprecated API</legend>
<$ doc.deprecated| marked $>
</fieldset>
<@ endif @>
<@ block dependencies @>
<@- if doc.requires @>
<h2 id="dependencies">Dependencies</h2>
<ul>
<@ for require in doc.requires @><li><$ require | link $></li><@ endfor @>
</ul>
<@ endif -@>
<@ endblock @>
<@ block additional @>
<@ endblock @>
<@ block examples @>
<@- if doc.examples @>
<h2 id="example">Example</h2>
<@- for example in doc.examples -@>
<$ example | marked $>
<@- endfor -@>
<@ endif -@>
<@ endblock @>
<@ endblock @>

View File

@ -0,0 +1,26 @@
---
<@ include "lib/yaml.template.html" @>
title: "<@ if doc.title @><$ doc.title $><@ elif doc.module @><$ doc.groupType | title $>s in module ionic<@ else @>Pages<@ endif @>"
header_sub_title: "<$ doc.components.length $> <$ doc.groupType $>s"
doc: "<$ doc.groupType $>"
docType: "<$ doc.groupType $>"
---
<@ block content @>
<$ doc.description $>
<table class="table">
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<@ for page in doc.components @>
<tr>
<td><$ page.id | link(page.name, page) $></td>
<td><$ page.description | firstParagraph | marked $></td>
</tr>
<@ endfor @>
</table>
<@ endblock @>

View File

@ -0,0 +1,9 @@
<@ extends "api/object.template.html" @>
<@ block related_components @>
<@ if doc.providerDoc -@>
<li>
<a href="<$ doc.providerDoc.path $>">- <$ doc.providerDoc.name $></a>
</li>
<@- endif @>
<@ endblock @>

View File

@ -0,0 +1,56 @@
<@ include "lib/macros.html" -@>
<@ extends "api/api.template.html" @>
<@ block additional @>
<@ block usage @>
<h2 id="usage">Usage</h2>
<@ if doc.usage @>
<$ doc.usage $>
<@ else @>
<@ if doc.restrict.element @>
```html
<<$ doc.name | dashCase $>
<@- for param in doc.params @>
<$ directiveParam(param.alias or param.name, param.type, '="', '"') $>
<@- endfor @>>
...
</<$ doc.name | dashCase $>>
```
<@ endif -@>
<@- if doc.restrict.attribute -@>
```html
<<$ doc.element $>
<@- for param in doc.params @>
<$ directiveParam(param.name, param.type, '="', '"') $>
<@- endfor @>>
...
</<$ doc.element $>>
```
<@ endif -@>
<@- if doc.restrict.cssClass -@>
```html
<@ set sep = joiner(' ') @>
<<$ doc.element $> class="
<@- for param in doc.params -@>
<$ sep() $><$ directiveParam(param.name, param.type, ': ', ';') $>
<@- endfor @>"> ... </<$ doc.element $>>
```
<@ endif -@>
<@- endif @>
<@ endblock -@>
<@ if doc.params @>
<h2 id="api" style="clear:both;">API</h2>
<$ paramTable(doc.params, true) $>
<@ endif @>
<@ include "lib/events.template.html" @>
<@ endblock @>

View File

@ -0,0 +1,26 @@
<@ include "lib/macros.html" -@>
<@ extends "api/api.template.html" @>
<@ block additional @>
<h2>Usage</h2>
<h3>In HTML Template Binding</h3>
<@ if doc.usage @>
<$ doc.usage | code $>
<@ else @>
<@ code -@>
{{ <$ doc.name $>_expression | <$ doc.name $>
<@- for param in doc.params @> : <$ param.name $><@ endfor -@>
}}
<@- endcode @>
<@ endif @>
<h3>In JavaScript</h3>
<@ code -@>
<@- set sep = joiner(', ') -@>
$filter('<$ doc.name $>')(<@ for param in doc.params @><$ sep() $><$ param.name $><@ endfor -@>)
<@- endcode @>
<$ paramTable(doc.params) $>
<@ include "lib/this.template.html" @>
<@ include "lib/returns.template.html" @>
<@ endblock @>

View File

@ -0,0 +1 @@
<@ extends "api/object.template.html" @>

View File

@ -0,0 +1,28 @@
<@ include "lib/macros.html" -@>
<@ extends "api/api.template.html" @>
<@ block additional @>
<@ if doc.usage @>
## Usage
<$ doc.usage $>
<@ endif @>
<@ if doc.params or doc.returns or doc.this or doc.kind == 'function' -@>
<h2 id="usage">Usage</h2>
<@ if doc.usage @>
<$ doc.usage $>
<@ else @>
<$ functionSyntax(doc) $>
<@ endif @>
<$ paramTable(doc.params) $>
<@ include "lib/this.template.html" @>
<@ include "lib/returns.template.html" @>
<@- endif @>
<@ include "lib/methods.template.html" @>
<@ include "lib/events.template.html" @>
<@ include "lib/properties.template.html" @>
<@ endblock @>

View File

@ -0,0 +1 @@
<@ extends "api/object.template.html" @>

View File

@ -0,0 +1,9 @@
<@ extends "api/object.template.html" @>
<@ block related_components @>
<@ if doc.serviceDoc -@>
<li>
<a href="<$ doc.serviceDoc.path $>">- <$ doc.serviceDoc.name $></a>
</li>
<@- endif @>
<@ endblock @>

View File

@ -0,0 +1,9 @@
<@ extends "api/object.template.html" @>
<@ block related_components @>
<@ if doc.providerDoc -@>
<li>
<a href="<$ doc.providerDoc.path $>">- <$ doc.providerDoc.name $></a>
</li>
<@- endif @>
<@ endblock @>

View File

@ -0,0 +1 @@
<@ extends "api/object.template.html" @>

View File

@ -0,0 +1,9 @@
<@ extends "api/object.template.html" @>
<@ block related_components @>
<@ if doc.providerDoc -@>
<li>
<a href="<$ doc.providerDoc.path $>">- <$ doc.providerDoc.name $></a>
</li>
<@- endif @>
<@ endblock @>

View File

@ -0,0 +1,17 @@
---
layout: "docs_api"
path: ""
title: Javascript
header_sub_title: Extend Ionic even further with the power of AngularJS
searchable: false
---
# AngularJS Extensions
Ionic is both a CSS framework and a Javascript UI library. Many components need Javascript in order to produce magic, though often components
can easily be used without coding through framework extensions such as our AngularIonic extensions.
Ionic follows the View Controller pattern popularized in such frameworks as Cocoa Touch. In the View Controller pattern, we treat different sections of the interface as child Views or even child View Controllers that contain other views. View Controllers then "power" the Views inside of them to provide interaction and UI functionality. A great example is the Tab Bar View Controller which processes taps on a Tab Bar to switch between a set of viewable panes.
Explore our API docs for detailed information on the View Controllers and Javascript utilities available in Ionic.

View File

@ -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 %}

View File

@ -0,0 +1,629 @@
<!-- Action Sheet -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicActionSheet/" class="api-section">
Action Sheet
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicActionSheet/">
$ionicActionSheet
</a>
</li>
</ul>
</li>
<!-- Backdrop -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicBackdrop/" class="api-section">
Backdrop
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicBackdrop/">
$ionicBackdrop
</a>
</li>
</ul>
</li>
<!-- Content -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionContent/" class="api-section">
Content
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionContent/">
ion-content
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionRefresher/">
ion-refresher
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionPane/">
ion-pane
</a>
</li>
</ul>
</li>
<!-- Form Inputs -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionCheckbox/" class="api-section">
Form Inputs
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionCheckbox/">
ion-checkbox
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionRadio/">
ion-radio
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionToggle/">
ion-toggle
</a>
</li>
</ul>
</li>
<!-- Gesture and Events -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/onHold/" class="api-section">
Gestures and Events
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/onHold/">
on-hold
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onTap/">
on-tap
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onDoubleTap/">
on-double-tap
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onTouch/">
on-touch
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onRelease/">
on-release
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onDrag/">
on-drag
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onDragUp/">
on-drag-up
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onDragRight/">
on-drag-right
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onDragDown/">
on-drag-down
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onDragLeft/">
on-drag-left
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onSwipe/">
on-swipe
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onSwipeUp/">
on-swipe-up
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onSwipeRight/">
on-swipe-right
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onSwipeDown/">
on-swipe-down
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/onSwipeLeft/">
on-swipe-left
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicGesture/">
$ionicGesture
</a>
</li>
</ul>
</li>
<!-- Headers/Footers -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionHeaderBar/" class="api-section">
Headers/Footers
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionHeaderBar/">
ion-header-bar
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionFooterBar/">
ion-footer-bar
</a>
</li>
</ul>
</li>
<!-- Keyboard -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/page/keyboard/" class="api-section">
Keyboard
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/page/keyboard/">
Keyboard
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/keyboardAttach/">
keyboard-attach
</a>
</li>
</ul>
</li>
<!-- Lists -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionList/" class="api-section">
Lists
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionList/">
ion-list
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionItem/">
ion-item
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionDeleteButton/">
ion-delete-button
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionReorderButton/">
ion-reorder-button
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionOptionButton/">
ion-option-button
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/collectionRepeat/">
collection-repeat
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicListDelegate/">
$ionicListDelegate
</a>
</li>
</ul>
</li>
<!-- Loading -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicLoading/" class="api-section">
Loading
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicLoading/">
$ionicLoading
</a>
</li>
</ul>
<ul>
<li>
<a href="{{ page.versionHref }}/api/object/$ionicLoadingConfig/">
$ionicLoadingConfig
</a>
</li>
</ul>
</li>
<!-- Modal -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicModal/" class="api-section">
Modal
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicModal/">
$ionicModal
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/controller/ionicModal/">
ionicModal
</a>
</li>
</ul>
</li>
<!-- Navigation -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionNavView/" class="api-section">
Navigation
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionNavView/">
ion-nav-view
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionView/">
ion-view
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionNavBar/">
ion-nav-bar
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionNavBackButton/">
ion-nav-back-button
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionNavButtons/">
ion-nav-buttons
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionNavTitle/">
ion-nav-title
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/navTransition/">
nav-transition
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/navDirection/">
nav-direction
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicNavBarDelegate/">
$ionicNavBarDelegate
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicHistory/">
$ionicHistory
</a>
</li>
</ul>
</li>
<!-- Platform -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicPlatform/" class="api-section">
Platform
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicPlatform/">
$ionicPlatform
</a>
</li>
</ul>
</li>
<!-- Popover -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicPopover/" class="api-section">
Popover
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicPopover/">
$ionicPopover
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/controller/ionicPopover/">
ionicPopover
</a>
</li>
</ul>
</li>
<!-- Popup -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/service/$ionicPopup/" class="api-section">
Popup
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicPopup/">
$ionicPopup
</a>
</li>
</ul>
</li>
<!-- Scroll -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionScroll/" class="api-section">
Scroll
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionScroll/">
ion-scroll
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionInfiniteScroll/">
ion-infinite-scroll
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicScrollDelegate/">
$ionicScrollDelegate
</a>
</li>
</ul>
</li>
<!-- Side Menus -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionSideMenus/" class="api-section">
Side Menus
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSideMenus/">
ion-side-menus
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSideMenuContent/">
ion-side-menu-content
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSideMenu/">
ion-side-menu
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/exposeAsideWhen/">
expose-aside-when
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/menuToggle/">
menu-toggle
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/menuClose/">
menu-close
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicSideMenuDelegate/">
$ionicSideMenuDelegate
</a>
</li>
</ul>
</li>
<!-- Slide Box -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionSlideBox/" class="api-section">
Slide Box
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSlideBox/">
ion-slide-box
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSlidePager/">
ion-slide-pager
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSlide/">
ion-slide
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicSlideBoxDelegate/">
$ionicSlideBoxDelegate
</a>
</li>
</ul>
</li>
<!-- Spinner -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionSpinner/" class="api-section">
Spinner
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionSpinner/">
ion-spinner
</a>
</li>
</ul>
</li>
<!-- Tabs -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/directive/ionTabs/" class="api-section">
Tabs
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/directive/ionTabs/">
ion-tabs
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/directive/ionTab/">
ion-tab
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicTabsDelegate/">
$ionicTabsDelegate
</a>
</li>
</ul>
</li>
<!-- Tap -->
<li class="menu-section">
<a href="{{ page.versionHref }}/api/page/tap/" class="api-section">
Tap &amp; Click
</a>
</li>
<!-- Utility -->
<li class="menu-section">
<a href="#" class="api-section">
Utility
</a>
<ul>
<li>
<a href="{{ page.versionHref }}/api/provider/$ionicConfigProvider/">
$ionicConfigProvider
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/utility/ionic.Platform/">
ionic.Platform
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/utility/ionic.DomUtil/">
ionic.DomUtil
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/utility/ionic.EventController/">
ionic.EventController
</a>
</li>
<li>
<a href="{{ page.versionHref }}/api/service/$ionicPosition/">
$ionicPosition
</a>
</li>
</ul>
</li>

View File

@ -0,0 +1,11 @@
<select onchange="window.location.href=this.options[this.selectedIndex].value">
<@ for ver in version.list @>
<option
value="<$ ver.href $>/{% if page.path != ''%}{{page.path}}{% else %}api/{% endif %}"
{% if page.version == "<$ ver.name $>"%}selected{% endif %}>
<$ ver.name $> <@ if version.latest.name == ver.name @>(latest)<@ endif @>
</option>
<@ endfor @>
</select>

View File

@ -0,0 +1,25 @@
<@- if doc.events @>
<h2>Events</h2>
<ul class="events">
<@- for event in doc.events @>
<li id="<$ event.name $>">
<h3><$ event.name $></h3>
<div><$ event.description | marked $></div>
<@- if event.eventType == 'listen' @>
<div class="inline">
<h4>Listen on: <$ event.eventTarget $></h4>
</div>
<@- else @>
<div class="inline">
<h4>Type:</h4>
<div class="type"><$ event.eventType $></div>
</div>
<div class="inline">
<h4>Target:</h4>
<div class="target"><$ event.eventTarget $></div>
</div>
<@ endif -@>
</li>
<@ endfor -@>
</ul>
<@ endif -@>

54
scripts/docs/templates/lib/macros.html vendored Normal file
View File

@ -0,0 +1,54 @@
<@ macro typeList(types) -@>
<@ set separator = joiner("|") @>
<@ for type in types @><$ separator() $><$ type | code $><@ endfor @>
<@- endmacro -@>
<@ macro paramTable(params, isDirective) @>
<table class="table" style="margin:0;">
<thead>
<tr>
<th><@ if isDirective @>Attr<@ else @>Param<@ endif @></th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<@ for param in params @>
<tr>
<td>
<$ param.name $>
<@ if param.alias @>| <$ param.alias $><@ endif @>
<@ if param.type.optional @><div><em>(optional)</em></div><@ endif @>
</td>
<td>
<$ typeList(param.typeList) $>
</td>
<td>
<$ param.description | marked $>
<@ if param.default @><p><em>(default: <$ param.default $>)</em></p><@ endif @>
</td>
</tr>
<@ endfor @>
</tbody>
</table>
<@ endmacro @>
<@- macro directiveParam(name, type, join, sep) @>
<@- if type.optional @>[<@ endif -@>
<$ name | dashCase $><$ join $><$ type.description $><$ sep $>
<@- if type.optional @>]<@ endif -@>
<@ endmacro -@>
<@- macro functionSyntax(fn) @>
<@- set sep = joiner(', ') -@>
<code><$ fn.name $>(<@- for param in fn.params @><$ sep() $>
<@- if param.type.optional @>[<@ endif -@>
<$ param.name $>
<@- if param.type.optional @>]<@ endif -@>
<@ endfor @>)</code><@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @>
<@ endmacro -@>
<@- macro typeInfo(fn) -@>
<$ typeList(fn.typeList) $> <$ fn.description $>
<@- endmacro -@>

View File

@ -0,0 +1,26 @@
<@- if doc.methods @>
## Methods
<@- for method in doc.methods @>
<div id="<$ method.name $>"></div>
<h2>
<$ functionSyntax(method) $>
</h2>
<$ method.description $>
<@ if method.params @>
<$ paramTable(method.params) $>
<@ endif @>
<@ if method.this @>
#### Method's `this`
<$ method.this $>
<@ endif @>
<@ if method.returns @>
* Returns: <$ typeInfo(method.returns) $>
<@ endif @>
<@ endfor -@>
<@- endif -@>

View File

@ -0,0 +1,14 @@
<@- if doc.properties @>
<h2 id="properties">Properties</h2>
<@- for property in doc.properties @>
<div id="<$ property.name $>"></div>
* <h3><$ typeList(property.returns.typeList) $> <code><$ property.name $></code></h3>
<$ property.returns.description $>
<$ property.description $>
<@ endfor -@>
</ul>
<@- endif -@>

View File

@ -0,0 +1,4 @@
<@ if doc.returns -@>
<h3>Returns</h3>
<$ typeInfo(doc.returns) $>
<@- endif @>

View File

@ -0,0 +1,4 @@
<@ if doc.this @>
<h3>Method's <@ code @>this<@ endcode @></h3>
<$ doc.this | marked $>
<@ endif @>

View File

@ -0,0 +1,4 @@
layout: "docs_api"
version: "<$ version.current.name $>"
versionHref: "<$ version.current.href $>"
path: "<$ doc.path $>"