Files
ionic-framework/scripts/docs/templates/common.template.html
2015-09-04 11:19:00 -05:00

179 lines
4.6 KiB
HTML

---
<@ 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 $>"
---
<@ macro paramList(paramData) -@>
<@- if paramData -@><span class="params">(
<@- for param in paramData -@>
<span class="param"><$ param | escape $><@ if not loop.last @>, <@ endif @></span>
<@- endfor @>)</span>
<@- endif @>
<@- endmacro -@>
<@ 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>
<@- 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 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 typeList(types) -@>
<@ set separator = joiner("|") @>
<@ for type in types @><$ separator() $><$ type | code $><@ endfor @>
<@- endmacro -@>
<@- macro typeInfo(fn) -@>
<$ typeList(fn.typeList) $> <$ fn.description $>
<@- endmacro -@>
<@ block body @>
<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 @>
<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/>
defined in <$ githubViewLink(doc) $>
</p>
<p><$ doc.description | marked $></p>
<@- if doc.decorators @>
<h2>Annotations</h2>
<@- for decorator in doc.decorators @>
<h3 class="annotation">@<$ decorator.name $><$ paramList(decorator.arguments) $></h3>
<@ endfor @>
<@ endif -@>
<@- if doc.members @>
## Members
<@- for method in doc.members @>
<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 -@>
<!-- Angular doc template
<@- if doc.constructorDoc or doc.members.length -@>
<h2>Members</h2>
<@- if doc.constructorDoc @>
<section class="member constructor">
<h1 id="constructor" class="name"><$ doc.constructorDoc.name $><$ paramList(doc.constructorDoc.paramData) $></h1>
<@ marked @>
<$ doc.constructorDoc.description $>
<@ endmarked @>
</section>
<@ endif -@>
<@- for member in doc.members @><@ if not member.private @>
<section class="member">
<h1 id="<$ member.name $>" class="name">
<$ member.name $><@ if member.optional @>?<@ endif @><$ paramList(member.params) $>
</h1>
<@ marked @>
<$ member.description $>
<@ endmarked @>
</section>
<@ endif @><@ endfor @>
<@- endif -@>
-->
<@ endblock @>
<@ endblock @>