From 03417df54e84facb5e7b7e64ca5169d15d51c14f Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 13 Aug 2018 08:13:03 +0100 Subject: [PATCH] build(docs-infra): display long overload parameter types as `object` (#24976) In some overloads, the parameter type can be a large anonymous object type. This change displays such types as `object`. It is then up to the documentation author to put more information about the type in the method usage notes. PR Close #24976 --- aio/tools/transforms/templates/api/lib/memberHelpers.html | 7 ++++--- aio/tools/transforms/templates/api/lib/paramList.html | 5 +---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index 0a15539262..4de717af19 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -54,7 +54,7 @@ {% endif %}
Parameters
-{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter') $} +{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter', true) $} {% if overload.type or overload.returns.type %}
Returns
@@ -157,7 +157,7 @@ {% if method.description -%} - {$ method.description | marked({ h3: 'h4' }) $} + {$ method.description | marked({ h3: 'h5' }) $} {%- endif %} @@ -165,7 +165,8 @@ {% if method.usageNotes -%} - {$ method.usageNotes | marked({ h3: 'h4' }) $} +

Usage Notes

+ {$ method.usageNotes | marked({ h3: 'h5' }) $} {%- endif %} diff --git a/aio/tools/transforms/templates/api/lib/paramList.html b/aio/tools/transforms/templates/api/lib/paramList.html index 8264f560bd..da0a9e78f9 100644 --- a/aio/tools/transforms/templates/api/lib/paramList.html +++ b/aio/tools/transforms/templates/api/lib/paramList.html @@ -21,10 +21,7 @@ {$ parameter.name $} - - {$ parameter.type $} - - {% if showType %}{$ parameter.type $}{% endif %} + {% if showType %}{% if r/^\{/.test(parameter.type) and r/\}$/.test(parameter.type) and parameter.type.length > 20 %}object{% else %}{$ parameter.type $}{% endif %}{% endif %} {% marked %} {% if (parameter.shortDescription | trim) or (parameter.description | trim) %}{$ parameter.shortDescription + '\n\n' + parameter.description $}