Merge pull request #52 from ihadeed/add-docs-platforms

chore(docs): add platforms decorator
This commit is contained in:
Ibrahim Hadeed 2016-03-14 13:25:16 -04:00
commit 363be2feb7

View File

@ -12,65 +12,65 @@ docType: "<$ doc.docType $>"
--- ---
<@ 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 -@>
<@ macro paramTable(params, isDirective) -@> <@ macro paramTable(params, isDirective) -@>
<table class="table param-table" style="margin:0;"> <table class="table param-table" style="margin:0;">
<thead> <thead>
<tr> <tr>
<th><@ if isDirective @>Attr<@ else @>Param<@ endif @></th> <th><@ if isDirective @>Attr<@ else @>Param<@ endif @></th>
<th>Type</th> <th>Type</th>
<th>Details</th> <th>Details</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<@ for param in params @> <@ for param in params @>
<tr> <tr>
<td> <td>
<$ param.name $> <$ param.name $>
<@ if param.alias @>| <$ param.alias $><@ endif @> <@ if param.alias @>| <$ param.alias $><@ endif @>
<@ if param.type.optional @><div><em>(optional)</em></div><@ endif @> <@ if param.type.optional @><div><em>(optional)</em></div><@ endif @>
</td> </td>
<td> <td>
<$ typeList(param.typeList) $> <$ typeList(param.typeList) $>
</td> </td>
<td> <td>
<$ param.description | marked $> <$ param.description | marked $>
<@ if param.default @><p><em>(default: <$ param.default $>)</em></p><@ endif @> <@ if param.default @><p><em>(default: <$ param.default $>)</em></p><@ endif @>
</td> </td>
</tr> </tr>
<@ endfor @> <@ endfor @>
</tbody> </tbody>
</table> </table>
<@- endmacro -@> <@- endmacro -@>
<@- macro functionSyntax(fn) @> <@- macro functionSyntax(fn) @>
<@- set sep = joiner(',&nbsp;') -@> <@- set sep = joiner(',&nbsp;') -@>
<code><$ fn.name $>(<@- for param in fn.params @><$ sep() $> <code><$ fn.name $>(<@- for param in fn.params @><$ sep() $>
<@- if param.type.optional @>[<@ endif -@> <@- if param.type.optional @>[<@ endif -@>
<$ param.name $> <$ param.name $>
<@- if param.type.optional @>]<@ endif -@> <@- if param.type.optional @>]<@ endif -@>
<@ endfor @>)</code> <@ endfor @>)</code>
<@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @> <@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @>
<@ endmacro -@> <@ endmacro -@>
<@ macro typeList(types) -@> <@ macro typeList(types) -@>
<@ set separator = joiner("|") @> <@ set separator = joiner("|") @>
<@ for type in types @><$ separator() $><$ type | code $><@ endfor @> <@ for type in types @><$ separator() $><$ type | code $><@ endfor @>
<@- endmacro -@> <@- endmacro -@>
<@- macro typeInfo(fn) -@> <@- macro typeInfo(fn) -@>
<$ typeList(fn.typeList) $> <$ fn.description $> <$ typeList(fn.typeList) $> <$ fn.description $>
<@- endmacro -@> <@- endmacro -@>
<@ block body @> <@ block body @>
@ -82,30 +82,30 @@ docType: "<$ doc.docType $>"
<h1 class="api-title"> <h1 class="api-title">
<@ if doc.docType == "directive" @> <@ if doc.docType == "directive" @>
<$ doc.name | dashCase $> <$ doc.name | dashCase $>
<@ else @> <@ else @>
<$ doc.name $> <$ doc.name $>
<@ endif @> <@ endif @>
<@ if doc.parent @> <@ if doc.parent @>
<br /> <br />
<small> <small>
Child of <$ doc.parent $> Child of <$ doc.parent $>
</small> </small>
<@ endif @> <@ endif @>
<@ if doc.delegate @> <@ if doc.delegate @>
<br/> <br/>
<small> <small>
Delegate: <$ doc.delegate $> Delegate: <$ doc.delegate $>
</small> </small>
<@ endif @> <@ endif @>
</h1> </h1>
<a class="improve-v2-docs" href='http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line $>'> <a class="improve-v2-docs" href='http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line $>'>
Improve this doc Improve this doc
</a> </a>
<@ if doc.codepen @> <@ if doc.codepen @>
@ -119,10 +119,23 @@ Improve this doc
<@ for prop in doc.decorators[0].argumentInfo @> <@ for prop in doc.decorators[0].argumentInfo @>
<pre><code>$ cordova plugin add <$ prop.plugin $></code></pre> <pre><code>$ cordova plugin add <$ prop.plugin $></code></pre>
<p>Repo: <p>Repo:
<a href="<$ prop.repo $>"> <a href="<$ prop.repo $>">
<$ prop.repo $> <$ prop.repo $>
</a> </a>
</p> </p>
<@ if prop.platforms @>
<!-- @platforms tag -->
<h2>Supported platforms</h2>
<@ block platforms @>
<ul>
<@- for platform in prop.platforms @>
<li><$ platform $></li>
<@ endfor -@>
</ul>
<@ endblock @>
<@ endif @>
<@ endfor @> <@ endfor @>
<@ endif -@> <@ endif -@>
@ -149,42 +162,42 @@ Improve this doc
<@ if doc.properties @> <@ if doc.properties @>
<h2>Attributes:</h2> <h2>Attributes:</h2>
<table class="table" style="margin:0;"> <table class="table" style="margin:0;">
<thead> <thead>
<tr> <tr>
<th>Attribute</th> <th>Attribute</th>
<@ set hasTypes = false @> <@ set hasTypes = false @>
<@ for prop in doc.properties @> <@ for prop in doc.properties @>
<@ if prop.type @> <@ if prop.type @>
<@ set hasTypes = true @> <@ set hasTypes = true @>
<@ endif @> <@ endif @>
<@ endfor @> <@ endfor @>
<@ if hasTypes @> <@ if hasTypes @>
<th>Type</th> <th>Type</th>
<@ endif @> <@ endif @>
<th>Description</th> <th>Description</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<@ for prop in doc.properties @> <@ for prop in doc.properties @>
<tr> <tr>
<td> <td>
<$ prop.name $> <$ prop.name $>
</td> </td>
<@ if hasTypes @> <@ if hasTypes @>
<td> <td>
<$ prop.type.name $> <$ prop.type.name $>
</td> </td>
<@ endif @> <@ endif @>
<td> <td>
<$ prop.description $> <$ prop.description $>
</td> </td>
</tr> </tr>
<@ endfor @> <@ endfor @>
</tbody> </tbody>
</table> </table>
<@ endif @> <@ endif @>
@ -194,6 +207,19 @@ Improve this doc
<div id="<$ method.name $>"></div> <div id="<$ method.name $>"></div>
<h3><$ functionSyntax(method) $></h3> <h3><$ functionSyntax(method) $></h3>
<@- if method.decorators @>
<@ for prop in method.decorators[0].argumentInfo @>
<@ if prop.platforms @>
<h4>Platforms:</h4>
<ul>
<@- for platform in prop.platforms @>
<li><$ platform $></li>
<@ endfor -@>
</ul>
<@ endif @>
<@ endfor @>
<@ endif -@>
<$ method.description $> <$ method.description $>
<@ if method.params @> <@ if method.params @>
@ -202,14 +228,14 @@ Improve this doc
<@ if method.this @> <@ if method.this @>
<h4> Method's `this` <h4> Method's `this`
<$ method.this $> <$ method.this $>
</h4> </h4>
<@ endif @> <@ endif @>
<@ if method.returns @> <@ if method.returns @>
<div class="return-value" markdown="1"> <div class="return-value" markdown="1">
<i class="icon ion-arrow-return-left"></i> <i class="icon ion-arrow-return-left"></i>
<b>Returns:</b> <$ typeInfo(method.returns) $> <b>Returns:</b> <$ typeInfo(method.returns) $>
</div> </div>
<@ endif @> <@ endif @>
<@ endif @> <@ endif @>
@ -225,7 +251,7 @@ Improve this doc
<div id="<$ method.name $>"></div> <div id="<$ method.name $>"></div>
<h3> <h3>
<$ functionSyntax(method) $> <$ functionSyntax(method) $>
</h3> </h3>
<$ method.description $> <$ method.description $>
@ -236,14 +262,14 @@ Improve this doc
<@ if method.this @> <@ if method.this @>
<h4> Method's `this` <h4> Method's `this`
<$ method.this $> <$ method.this $>
</h4> </h4>
<@ endif @> <@ endif @>
<@ if method.returns @> <@ if method.returns @>
<div class="return-value" markdown="1"> <div class="return-value" markdown="1">
<i class="icon ion-arrow-return-left"></i> <i class="icon ion-arrow-return-left"></i>
<b>Returns:</b> <$ typeInfo(method.returns) $> <b>Returns:</b> <$ typeInfo(method.returns) $>
</div> </div>
<@ endif @> <@ endif @>