UNPKG

suh-dgeni-ngdocs

Version:

A package to generate ng-docs similar to what is used on AngularJS website.

76 lines (69 loc) 2.08 kB
{% macro typeList(types) -%} {% for typeName in types %}<a href="" class="uk-badge uk-badge-primary {$ typeName | typeClass $}">{$ typeName | escape $}</a>{% endfor %} {%- endmacro -%} {%- macro paramTable(params) %} <table class="uk-table"> <thead> <tr> <th class="uk-width-2-10">Param</th> <th class="uk-width-1-10">Type</th> <th class="uk-width-7-10">Details</th> </tr> </thead> <tbody> {% for param in params %} <tr> <td> {$ param.name $} {% if param.alias %}| {$ param.alias $}{% endif %} {% if param.optional %}<div><em>(optional)</em></div>{% endif %} </td> <td> {$ typeList(param.typeList) $} </td> <td> {$ param.description | marked $} {% if param.defaultValue %}<p><em>(default: {$ param.defaultValue $})</em></p>{% endif %} </td> </tr> {% endfor %} </tbody> </table> {% endmacro -%} {%- macro todosList(title,todos) %} <div class="ngdocs-object-todos"> <h2>{$ title $}</h2> <ul class="uk-list uk-list-line"> {% set dex = 0 %} {% for grouper,list in todos | groupby('type') %} {% for todo in list %} {% set dex = dex + 1%} <li><span class="uk-badge uk-badge-{$ todo.type $}">{$ dex $}</span> {$ todo.value $}</li> {% endfor %} {% endfor %} </ul> </div> {% 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(', ') -%} {% marked -%} `{$ fn.name $}({%- for param in fn.params %}{$ sep() $} {%- if param.type.optional %}[{% endif -%} {$ param.name $} {%- if param.type.optional %}]{% endif -%} {% endfor %});` {%- endmarked %} {% endmacro -%} {%- macro typeInfo(fn) -%} <table class="uk-table variables-matrix return-arguments"> <tr> <td>{$ typeList(fn.typeList) $}</td> <td>{$ fn.description | marked $}</td> </tr> </table> {%- endmacro -%}