angular-cn/aio/tools/transforms/templates/api/lib/descendants.html

22 lines
865 B
HTML
Raw Normal View History

{% macro renderDescendantList(descendants, descendantType, recursed, docTypeMatcher) %}
{% if descendants.length %}
<ul>
{% for descendant in descendants %}
<li>
<code>{$ descendant.name $}</code>
{$ renderDescendantList(descendant.descendants | filterByPropertyValue('docType', docTypeMatcher), docType, recursed, docTypeMatcher) $}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro -%}
{%- macro renderDescendants(doc, descendantType, title='', recursed=true, docTypeMatcher=descendantType) %}
{% set descendants = doc.descendants | filterByPropertyValue('docType', docTypeMatcher) %}
{% if descendants.length %}
<div class="descendants {$ descendantType $}">
{% if title %}<h2>{$ title $}</h2>{% endif %}
{$ renderDescendantList(descendants, descendantType, recursed, docTypeMatcher) $}
</div>
{% endif %}
{% endmacro %}