fix(docs-infra): update overload rendering (#24976)

Based on the review here:
https://github.com/angular/angular/pull/24976#issuecomment-415535125

PR Close #24976
This commit is contained in:
Pete Bacon Darwin
2018-10-18 20:53:07 +01:00
committed by Kara Erickson
parent 03417df54e
commit 18b6d580c5
7 changed files with 259 additions and 339 deletions

View File

@ -40,46 +40,47 @@
{%- endmacro -%}
{%- macro renderOverloadInfo(overload, cssClass, method) -%}
<div class="overload-info">
{% if overload.shortDescription and (overload.shortDescription != method.shortDescription) %}
<div class="short-description">
{$ overload.shortDescription | marked $}
</div>{% endif %}
{% if overload.shortDescription and (overload.shortDescription != method.shortDescription) %}
<div class="short-description">
{$ overload.shortDescription | marked $}
</div>{% endif %}
<code-example language="ts" hideCopy="true" linenums="false" class="no-box api-heading">{$ renderMemberSyntax(overload) $}</code-example>
<code-example language="ts" hideCopy="true" linenums="false" class="no-box api-heading">{$ renderMemberSyntax(overload) $}</code-example>
{% if overload.deprecated !== undefined %}
<div class="deprecated">
{$ ('**Deprecated** ' + overload.deprecated) | marked $}
</div>{% endif %}
{% if overload.deprecated !== undefined %}
<div class="deprecated">
{$ ('**Deprecated** ' + overload.deprecated) | marked $}
</div>{% endif %}
<h6 class="no-anchor">Parameters</h6>
{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter', true) $}
<h6 class="no-anchor">Parameters</h6>
{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter', true) $}
{% if overload.type or overload.returns.type %}
<h6 class="no-anchor">Returns</h6>
{% marked %}`{$ (overload.type or overload.returns.type) $}`{% if overload.returns %}: {$ overload.returns.description $}{% endif %}{% endmarked %}
{% endif %}
{% if overload.type or overload.returns.type %}
<h6 class="no-anchor">Returns</h6>
{% marked %}`{$ (overload.type or overload.returns.type) $}`{% if overload.returns %}: {$ overload.returns.description $}{% endif %}{% endmarked %}
{% endif %}
{% if overload.throws.length %}
<h6 class="no-anchor">Throws</h6>
{% for error in overload.throws %}
{% marked %}`{$ (error.typeList or 'Error') $}` {$ error.description $}{% endmarked %}
{% endfor %}
{% endif %}
{% if overload.throws.length %}
<h6 class="no-anchor">Throws</h6>
{% for error in overload.throws %}
{% marked %}`{$ (error.typeList or 'Error') $}` {$ error.description $}{% endmarked %}
{% endfor %}
{% endif %}
{% if overload.description and (overload.description != method.description) -%}
<div class="description">
{$ overload.description | marked $}
{% if overload.description and (overload.description != method.description) -%}
<div class="description">
{$ overload.description | marked $}
</div>
{%- endif %}
</div>
{%- endif %}
{%- endmacro -%}
{%- macro renderMethodDetail(versionInfo, method, cssClass) -%}
<a id="{$ method.anchor $}"></a>
<table class="is-full-width method-table {$ cssClass $}">
{% if method.name !== 'constructor' %}<thead><tr><th class="icon-action-header">
{% if method.name !== 'constructor' %}<thead><tr><th>
<div class="with-github-links">
<h3>
{% if method.isCallMember %}<i>call signature</i>
@ -123,10 +124,10 @@
<details class="overloads">
<summary>
<div class="icon-action-header">
<h4 class="no-anchor">Overloads</h4>
<h4 class="no-anchor">{$ method.overloads.length $} overloads...</h4>
<a>
<span class="show-all">Show All</span>
<span class="collapse-all">Collapse All</span>
<span class="collapse-all">Hide All</span>
<i class="material-icons expand">expand_more</i>
</a>
</div>
@ -137,17 +138,10 @@
<hr class="hr-margin fullwidth">
{% endif %}
{% for overload in method.overloads %}
<details class="overload"{% if loop.first %} open{% endif %}>
<summary>
<div class="icon-action-header">
<h5 class="no-anchor">Overload #{$ loop.index $} of {$ method.overloads.length $}</h5>
<a><i class="material-icons expand">expand_more</i></a>
</div>
</summary>
{$ renderOverloadInfo(overload, cssClass + '-overload', method) $}
{% if not loop.last %}<hr class="hr-margin">{% endif %}
</details>
{% endfor %}
<h5 class="no-anchor">Overload #{$ loop.index $}</h5>
{$ renderOverloadInfo(overload, cssClass + '-overload', method) $}
{% if not loop.last %}<hr class="hr-margin">{% endif %}
{% endfor %}
</div>
</details>
</td>