# Conflicts: # .travis.yml # aio/content/guide/aot-compiler.md # aio/content/guide/architecture.md # aio/content/guide/build.md # aio/content/guide/dependency-injection-in-action.md # aio/content/guide/deployment.md # aio/content/guide/elements.md # aio/content/guide/file-structure.md # aio/content/guide/glossary.md # aio/content/guide/hierarchical-dependency-injection.md # aio/content/guide/lifecycle-hooks.md # aio/content/guide/ngmodule-faq.md # aio/content/guide/pipes.md # aio/content/guide/router.md # aio/content/guide/rx-library.md # aio/content/guide/service-worker-communications.md # aio/content/guide/service-worker-config.md # aio/content/guide/singleton-services.md # aio/content/guide/template-syntax.md # aio/content/guide/testing.md # aio/content/guide/typescript-configuration.md # aio/content/guide/universal.md # aio/content/marketing/docs.md # aio/content/marketing/features.html # aio/content/tutorial/toh-pt0.md # aio/content/tutorial/toh-pt6.md # aio/package.json # aio/src/app/layout/footer/footer.component.html # aio/tools/transforms/templates/api/lib/memberHelpers.html # aio/yarn.lock # integration/cli-hello-world-ivy-minimal/src/polyfills.ts # modules/benchmarks/e2e_test/largetable_perf.ts # modules/benchmarks/e2e_test/largetable_spec.ts # packages/animations/src/animation_metadata.ts # packages/common/http/src/headers.ts # packages/common/http/src/interceptor.ts # packages/common/src/directives/ng_for_of.ts # packages/common/src/directives/ng_if.ts # packages/common/src/directives/ng_style.ts # packages/common/src/directives/ng_switch.ts # packages/core/src/change_detection/change_detection_util.ts # packages/core/src/di/injectable.ts # packages/core/src/interface/lifecycle_hooks.ts # packages/core/src/linker/template_ref.ts # packages/core/src/metadata/di.ts # packages/core/src/metadata/directives.ts # packages/core/src/metadata/ng_module.ts # packages/core/src/render/api.ts # packages/forms/src/form_providers.ts # packages/forms/src/model.ts # packages/router/src/config.ts # packages/router/src/directives/router_link.ts
113 lines
4.1 KiB
HTML
113 lines
4.1 KiB
HTML
{% macro renderSyntax(container, prefix) -%}
|
|
{% for name in container.names %}
|
|
<code-example hideCopy="true" class="no-box api-heading no-auto-link">ng {%if prefix %}{$ prefix $} {% endif %}<span class="cli-name">{$ name $}</span>
|
|
{%- for arg in container.positionalOptions %} <<var>{$ arg.name $}</var>>{% endfor %}
|
|
{%- if container.namedOptions.length %} [<var>options</var>]{% endif -%}
|
|
</code-example>
|
|
{% endfor %}
|
|
{% endmacro %}
|
|
|
|
{% macro renderArguments(arguments, level = 2) %}
|
|
{% if arguments.length %}
|
|
<h{$ level $} class="no-anchor" id="arguments">参数</h{$ level $}>
|
|
<table class="is-full-width list-table property-table">
|
|
<thead>
|
|
<tr>
|
|
<th>参数</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for option in arguments %}
|
|
<tr class="cli-option">
|
|
<td><code class="no-auto-link"><<var>{$ option.name $}</var>></code></td>
|
|
<td>
|
|
{$ option.description | marked $}
|
|
{% if option.subcommands.length -%}
|
|
<p>该选项可以接受下列<a href="#{$ option.name $}-commands">子命令</a>之一:<p>
|
|
<ul>
|
|
{% for subcommand in option.subcommands %}
|
|
<li><code class="no-auto-link"><a class="code-anchor" href="#{$ subcommand.name $}-command">{$ subcommand.name $}</a></code></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{%- endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro renderNamedOptions(options, level = 2) %}
|
|
{% if options.length %}
|
|
<h{$ level $} class="no-anchor" id="options">选项</h{$ level $}>
|
|
<table class="is-full-width list-table property-table">
|
|
<thead>
|
|
<tr>
|
|
<th>选项</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for option in options %}
|
|
<tr class="cli-option">
|
|
<td>
|
|
<code class="cli-option-syntax no-auto-link{% if option.deprecated %} deprecated-api-item{% endif %}">{$ renderOption(option.name, option.type, option.default, option.enum) $}</code>
|
|
</td>
|
|
<td>
|
|
{% if option.deprecated %}
|
|
{% if option.deprecated === true %}
|
|
<p><strong>Deprecated</strong></p>
|
|
{% else %}
|
|
{$ ('**Deprecated:** ' + option.deprecated) | marked $}
|
|
{% endif %}
|
|
{% endif %}
|
|
{$ option.description | marked $}
|
|
{% if option.default !== undefined %}<p><span class="cli-default">默认值:</span> <code class="no-auto-link">{$ option.default $}</code></p>{% endif %}
|
|
{% if option.aliases.length %}<p><span class="cli-aliases">别名:</span> {% for alias in option.aliases %}{$ renderOptionName(alias) $}{% if not loop.last %}, {% endif %}{% endfor %}</p>{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{%- macro renderOptionName(name) -%}
|
|
{% if name.length > 1 %}-{% endif %}-{$ name $}
|
|
{%- endmacro %}
|
|
|
|
{%- macro renderValues(values, default) -%}
|
|
{%- set valString = values.join('|') -%}
|
|
{%- if valString.length > 15 %}<br> {% endif %}{$ valString $}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro renderOption(name, type, default, values) -%}
|
|
{% set prefix = '--' if name.length > 1 else '-' %}
|
|
{%- if type === 'boolean' and not values.length %}{$ prefix $}{$ name $}={$ renderValues([true, false], default) $}
|
|
{%- elif values.length -%}
|
|
{$ prefix $}{$ name $}={$ renderValues(values, default) $}
|
|
{%- elif type === 'string' -%}
|
|
{$ prefix $}{$ name $}={% if name.length > 15 %}<br> {% endif %}<var>{$ name $}</var>
|
|
{%- else -%}
|
|
{$ prefix $}{$ name $}
|
|
{%- endif -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro renderSubcommands(container) -%}
|
|
{% for command in container.positionalOptions %}{% if command.subcommands.length %}
|
|
<h2><a id="{$ command.name $}-commands"></a>{$ command.name | title $} 命令</h2>
|
|
{% for subcommand in command.subcommands %}
|
|
<h3><code class="no-auto-link"><a id="{$ subcommand.name $}-command"></a>{$ subcommand.name $}</code></h3>
|
|
{% for name in container.names %}
|
|
{$ renderSyntax(subcommand, name) $}
|
|
{% endfor %}
|
|
{$ subcommand.description | marked $}
|
|
{# for now we assume that commands do not have further sub-commands #}
|
|
{$ renderArguments(subcommand.positionalOptions, 4) $}
|
|
{$ renderNamedOptions(subcommand.namedOptions, 4) $}
|
|
{% endfor %}
|
|
{% endif %}{% endfor %}
|
|
{%- endmacro -%}
|