Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
309 lines (262 sloc) 5.4 KB
{namespace ElectricAPIEntities}
/**
*/
{template .render}
{@param entityData: ?}
{@param project: ?}
<div>
{if $entityData}
{call .entity data="all" /}
{/if}
</div>
{/template}
/**
*/
{template .augments}
{@param augments: ?}
<div class="entity-augments">
{foreach $augmentation in $augments}
<span>{$augmentation.title} </span>
{if $augmentation.link}
<a href="/api/{$augmentation.link}.html">{$augmentation.name}</a>
{else}
<code>{$augmentation.name}</code>
{/if}
{/foreach}
</div>
{/template}
/**
*/
{template .default}
{@param default: ?}
<div class="entity-default">
<span>Default: <code>{$default}</code></span>
</div>
{/template}
/**
*/
{template .description}
{@param description: ?}
{if $description.type == 'html' or $description.type == 'text'}
{$description.value}
{elseif $description.type == 'inlineCode'}
<code>{$description.value}</code>
{elseif $description.children}
{foreach $child in $description.children}
{call .description}
{param description: $child /}
{/call}
{/foreach}
{/if}
{/template}
/**
*/
{template .entity}
{@param entityData: ?}
{@param project: ?}
<section class="card entity" data-access="{$entityData.access ? $entityData.access : 'public'}" id="{$entityData.name}">
{call .entityHeader data="all" /}
{if $entityData.augments}
{call .augments}
{param augments: $entityData.augments /}
{/call}
{/if}
{if $entityData.description}
<div class="entity-description">
{call .description}
{param description: $entityData.description /}
{/call}
</div>
{/if}
{if $entityData.default}
{call .default}
{param default: $entityData.default /}
{/call}
{/if}
{if $entityData.params}
{call .params}
{param params: $entityData.params /}
{/call}
{/if}
{if $entityData.returns}
{call .returns}
{param returns: $entityData.returns /}
{/call}
{/if}
{if $entityData.members}
{call .members data="all"}
{param members: $entityData.members /}
{/call}
{/if}
</section>
{/template}
/**
*/
{template .entityHeader}
{@param entityData: ?}
{@param project: ?}
<div class="entity-header">
{call .entityName data="all" /}
{let $loc: $entityData.context.loc /}
{let $filePath: $entityData.context.file + '#L' + $loc.start.line + ($loc.end.line != $loc.start.line ? '-L' + $loc.end.line : '') /}
<a
class="entity-link"
href="https://github.com/{$project.user}/{$project.repo}/tree/{$project.ref}/{$filePath}"
>
{$filePath}
</a>
</div>
{/template}
/**
*/
{template .entityName}
{@param entityData: ?}
<h1 class="entity-name">
<a href="#{$entityData.name}">
{if $entityData.access}
<span class="entity-access">{$entityData.access + ' '}</span>
{/if}
{$entityData.name}
{if $entityData.kind == 'function' or $entityData.name == 'constructor'}
(
{if $entityData.params}
{call .inlineParams}
{param params: $entityData.params /}
{/call}
{/if}
)
{elseif $entityData.type}
<span class="entity-name-type">:{$entityData.type}</span>
{/if}
</a>
</h1>
{/template}
/**
*/
{template .inlineParams}
{@param params: ?}
<span>
{foreach $param in $params}
{$param.name}
{if not isLast($param)}
{', '}
{/if}
{/foreach}
</span>
{/template}
/**
*/
{template .members}
{@param members: ?}
{@param project: ?}
<div class="entity-members">
{if $members.properties and $members.properties.length}
<h2>Properties:</h2>
{foreach $property in $members.properties}
{call .entity data="all"}
{param entityData: $property /}
{param instance: true /}
{/call}
{/foreach}
{/if}
{if $members.methods and $members.methods.length}
<h2>Methods:</h2>
{foreach $method in $members.methods}
{call .entity data="all"}
{param entityData: $method /}
{param instance: true /}
{/call}
{/foreach}
{/if}
{if $members.static and $members.static.length}
<h2>Static:</h2>
{foreach $staticMember in $members.static}
{call .entity data="all"}
{param entityData: $staticMember /}
{param static: true /}
{/call}
{/foreach}
{/if}
</div>
{/template}
/**
*/
{template .param}
{@param param: ?}
<tr>
<td>{$param.name}</td>
<td>
{if $param.type}
{call .type}
{param type: $param.type /}
{/call}
{/if}
</td>
<td>
{if $param.description}
{call .description}
{param description: $param.description /}
{/call}
{/if}
</td>
</tr>
{/template}
/**
*/
{template .params}
{@param params: ?}
<div class="entity-params">
<div class="datatable">
<table class="table">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{foreach $param in $params}
{call .param}
{param param: $param /}
{/call}
{/foreach}
</tbody>
</table>
</div>
</div>
{/template}
/**
*/
{template .returns}
{@param returns: ?}
<div class="entity-returns">
{let $return: $returns[0] /}
<span>
Returns: <code>
{call .type}
{param type: $return.type /}
{/call}
</code>
</span>
{if $return.description}
<div>
{call .description}
{param description: $return.description /}
{/call}
</div>
{/if}
</div>
{/template}
/**
*/
{template .type}
{@param type: ?}
<span>
{if $type.expression}
{$type.expression.name}
{else}
{$type.name}
{/if}
</span>
{/template}