Pete Bacon Darwin d509bd6849 build(aio): improve the API Pipe pages (#22702)
This change adds:

* an impure badge for Pipes that are marked as  `pure: false`
* a pipe specific overview that shows the syntax for using a pipe in a template.
* an "input value" section describing the type of the value that the pipe expects.
* a "pipe params" section describing any additional params that a pipe expects.

PR Close #22702
2018-03-14 14:21:11 -07:00

37 lines
1.4 KiB
HTML

{% macro paramList(params, truncateLines) -%}
{%- if params -%}
({%- for param in params -%}
{$ param | escape | truncateCode(truncateLines) $}{% if not loop.last %}, {% endif %}
{%- endfor %})
{%- endif %}
{%- endmacro -%}
{% macro returnType(returnType) -%}
{%- if returnType %}: {$ returnType | escape $}{% endif -%}
{%- endmacro -%}
{%- macro renderParameters(parameters, containerClass, parameterClass, showType) -%}
{%- if parameters.length -%}
<table class="is-full-width list-table parameters-table {$ containerClass $}">
<tbody>
{% for parameter in parameters %}
<tr class="{$ parameterClass $}">
<td class="param-name"><a id="{$ parameter.anchor $}"></a>{$ parameter.name $}</td>
{% if showType %}<td class="param-type"><code>{$ parameter.type $}</code></td>{% endif %}
<td class="param-description">
{% marked %}
{% if parameter.isOptional or parameter.defaultValue !== undefined %}Optional. Default is `{$ parameter.defaultValue === undefined and 'undefined' or parameter.defaultValue $}`.{% endif %}
{% if parameter.description | trim %}{$ parameter.description $}
{% elseif not showType and parameter.type %}<p>Type: <code>{$ parameter.type $}</code>.</p>
{% endif %}
{% endmarked %}
</td>
</tr>{% endfor %}
</tbody>
</table>
{%- else -%}
<p>There are no parameters.</p>
{%- endif -%}
{%- endmacro -%}