feat: 汉化 API 模板
This commit is contained in:
parent
b8dbc5d16e
commit
cb84b1d1c6
|
@ -19,10 +19,10 @@
|
|||
<header class="api-header">
|
||||
<h1>{$ doc.name $}</h1>
|
||||
<label class="api-type-label {$ doc.docType $}">{$ doc.docType $}</label>
|
||||
{% if doc.deprecated !== undefined %}<label class="api-status-label deprecated">deprecated</label>{% endif %}
|
||||
{% if doc.experimental !== undefined %}<label class="api-status-label experimental">experimental</label>{% endif %}
|
||||
{% if doc.stable !== undefined %}<label class="api-status-label stable">stable</label>{% endif %}
|
||||
{% if doc.pipeOptions.pure === 'false' %}<label class="api-status-label impure-pipe">impure</label>{% endif %}
|
||||
{% if doc.deprecated !== undefined %}<label class="api-status-label deprecated">已弃用</label>{% endif %}
|
||||
{% if doc.experimental !== undefined %}<label class="api-status-label experimental">试验性的</label>{% endif %}
|
||||
{% if doc.stable !== undefined %}<label class="api-status-label stable">稳定</label>{% endif %}
|
||||
{% if doc.pipeOptions.pure === 'false' %}<label class="api-status-label impure-pipe">非纯管道</label>{% endif %}
|
||||
</header>
|
||||
<aio-toc class="embedded"></aio-toc>
|
||||
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
{% block details %}
|
||||
{% block additional %}{% endblock %}
|
||||
{% include "includes/description.html" %}
|
||||
{$ memberHelpers.renderProperties(doc.staticProperties, 'static-properties', 'static-property', 'Static properties') $}
|
||||
{$ memberHelpers.renderMethodDetails(versionInfo, doc.staticMethods, 'static-methods', 'static-method', 'Static methods') $}
|
||||
{$ memberHelpers.renderProperties(doc.staticProperties, 'static-properties', 'static-property', '静态属性') $}
|
||||
{$ memberHelpers.renderMethodDetails(versionInfo, doc.staticMethods, 'static-methods', 'static-method', '静态方法') $}
|
||||
{% if doc.constructorDoc %}
|
||||
<h2>Constructor</h2>
|
||||
<h2 id="constructor">构造函数</h2>
|
||||
{$ memberHelpers.renderMethodDetail(versionInfo, doc.constructorDoc, 'constructor') $}{% endif %}
|
||||
|
||||
{$ memberHelpers.renderProperties(doc.properties, 'instance-properties', 'instance-property', 'Properties') $}
|
||||
{$ memberHelpers.renderProperties(doc.properties, 'instance-properties', 'instance-property', '属性') $}
|
||||
|
||||
{$ memberHelpers.renderMethodDetails(versionInfo, doc.methods, 'instance-methods', 'instance-method', 'Methods') $}
|
||||
{$ memberHelpers.renderMethodDetails(versionInfo, doc.methods, 'instance-methods', 'instance-method', '方法') $}
|
||||
|
||||
{% block annotations %}{% include "includes/annotations.html" %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{% include "includes/description.html" %}
|
||||
|
||||
<section class="decorator-options">
|
||||
<h2>Options</h2>
|
||||
<h2 id="options">选项</h2>
|
||||
{% for option in doc.members %}
|
||||
<a id="{$ option.anchor $}"></a>
|
||||
<table class="is-full-width option-table">
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
{% block overview %}{% include "includes/directive-overview.html" %}{% endblock %}
|
||||
{% block additional -%}
|
||||
{% include "includes/selectors.html" %}
|
||||
{$ directiveHelper.renderBindings(doc.inputs, 'inputs', 'input', 'Inputs') $}
|
||||
{$ directiveHelper.renderBindings(doc.outputs, 'outputs', 'output', 'Outputs') $}
|
||||
{$ directiveHelper.renderBindings(doc.inputs, 'inputs', 'input', '输入参数') $}
|
||||
{$ directiveHelper.renderBindings(doc.outputs, 'outputs', 'output', '输出参数') $}
|
||||
{% include "includes/export-as.html" %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -10,5 +10,5 @@ enum {$ doc.name $} {{$ memberHelpers.renderMembers(doc) $}
|
|||
</section>
|
||||
|
||||
{% include "includes/description.html" %}
|
||||
{$ memberHelpers.renderProperties(doc.properties, 'members', 'member', 'Members', ['Member', 'Value']) $}
|
||||
{% endblock %}
|
||||
{$ memberHelpers.renderProperties(doc.properties, 'members', 'member', '成员列表', ['成员', '值']) $}
|
||||
{% endblock %}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% include "includes/description.html" %}
|
||||
{% if doc.overloads.length >= 3 %}
|
||||
<section class="overloads">
|
||||
<h2>Overloads</h2>
|
||||
<h2 id="overloads">重载形式</h2>
|
||||
<table>
|
||||
{% for overload in doc.overloads %}
|
||||
<tr>
|
||||
|
@ -30,4 +30,4 @@
|
|||
</table>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%- if doc.decorators.length %}
|
||||
<section class="annotations">
|
||||
<h2>Annotations</h2>
|
||||
<h2 id="annotations">注解</h2>
|
||||
{%- for decorator in doc.decorators %}
|
||||
<code-example language="ts" hideCopy="true" class="no-box api-heading">@{$ decorator.name $}({$ decorator.arguments $})</code-example>
|
||||
{% if not decorator.notYetDocumented %}{$ decorator.description | marked $}{% endif %}
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
{% if doc.isAbstract %}abstract {% endif%}{$ doc.docType $} {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHeritage(doc) $} {{$ memberHelper.renderMembers(doc) $}
|
||||
}
|
||||
</code-example>
|
||||
{$ descendants.renderDescendants(doc, 'class', 'Subclasses') $}
|
||||
{$ descendants.renderDescendants(doc, 'class', '子类') $}
|
||||
</section>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% macro renderOptionsTable(doc) %}
|
||||
<table class="is-full-width list-table option-overview">
|
||||
<thead>
|
||||
<tr><th>Option</th><th>Description</th></tr>
|
||||
<tr><th>选项</th><th>说明</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%- for option in doc.members %}
|
||||
|
@ -20,7 +20,7 @@
|
|||
</table>
|
||||
|
||||
{% for ancestor in doc.extendsClauses %}{% if ancestor.doc %}
|
||||
<h3 class="no-toc">Inherited from <a class="code-anchor" href="{$ ancestor.doc.path $}">{$ ancestor.doc.name $}</a> decorator</h3>
|
||||
<h3 class="no-toc">继承自 <a class="code-anchor" href="{$ ancestor.doc.path $}">{$ ancestor.doc.name $}</a> 装饰器</h3>
|
||||
{$ renderOptionsTable(ancestor.doc) $}
|
||||
{% endif %}{% endfor %}
|
||||
{% endmacro %}
|
||||
|
@ -28,6 +28,6 @@
|
|||
{% if doc.members.length %}
|
||||
<section class="decorator-overview">
|
||||
{$ renderOptionsTable(doc) $}
|
||||
{$ descendants.renderDescendants(doc, 'decorator', 'Subclasses') $}
|
||||
{$ descendants.renderDescendants(doc, 'decorator', '子类') $}
|
||||
</section>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% if doc.deprecated %}
|
||||
<section class="deprecated">
|
||||
<h2>Deprecation notes</h2>
|
||||
<h2 id="deprecation-notes">弃用说明</h2>
|
||||
{$ doc.deprecated | marked $}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% if doc.description %}
|
||||
<section class="description">
|
||||
<h2>Description</h2>
|
||||
<h2 id="description">说明</h2>
|
||||
{$ doc.description | trimBlankLines | marked $}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%- if doc.exportAs %}
|
||||
<section class="export-as">
|
||||
<h2>Exported as</h2>
|
||||
<h2 id="exported-as">导出为</h2>
|
||||
<div>
|
||||
<code>{$ doc.exportAs $}</code>
|
||||
</div>
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
<table class="is-full-width">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>npm Package</th>
|
||||
<th>npm 包</th>
|
||||
<td><a href="https://www.npmjs.com/package/@angular/{$ doc.moduleDoc.id.split('/')[0] $}">@angular/{$ doc.moduleDoc.id.split('/')[0] $}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Module</th>
|
||||
<th>模块</th>
|
||||
<td><code>import { {$ doc.name $} } from <a href="{$ doc.moduleDoc.path $}">'@angular/{$ doc.moduleDoc.id $}'</a>;</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Source</th>
|
||||
<th>源码</th>
|
||||
<td>{$ github.githubViewLink(doc, versionInfo) $}</td>
|
||||
</tr>
|
||||
{% if doc.ngModule %}
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
interface {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHeritage(doc) $} {{$ memberHelper.renderMembers(doc) $}
|
||||
}
|
||||
</code-example>
|
||||
{$ descendants.renderDescendants(doc, 'interface', 'Child interfaces') $}
|
||||
{$ descendants.renderDescendants(doc, 'class', 'Class implementations') $}
|
||||
</section>
|
||||
{$ descendants.renderDescendants(doc, 'interface', '子接口') $}
|
||||
{$ descendants.renderDescendants(doc, 'class', '实现类') $}
|
||||
</section>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% if doc.members.length %}
|
||||
<section class="meta-data">
|
||||
<h2>Metadata properties</h2>
|
||||
<h2 id="metadata-properties">元数据属性列表</h2>
|
||||
{% for metadata in doc.members %}{% if not metadata.internal %}
|
||||
<div class="metadata-member">
|
||||
<a name="{$ metadata.name $}" class="anchor-offset"></a>
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
{%- endfor %} }}</code-example>
|
||||
|
||||
{% if doc.valueParam.type %}
|
||||
<h2>Input value</h2>
|
||||
<h2 id="input-value">输入值</h2>
|
||||
{$ params.renderParameters([doc.valueParam], 'pipe-parameters', 'pipe-parameter', true) $}
|
||||
{% endif %}
|
||||
{% if doc.pipeParams.length %}
|
||||
<h2>Parameters</h2>
|
||||
<h2 id="parameters">参数</h2>
|
||||
{$ params.renderParameters(doc.pipeParams, 'pipe-parameters', 'pipe-parameter', true) $}
|
||||
{% endif %}
|
||||
</section>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% if doc.security %}
|
||||
<section "security">
|
||||
<h2>Security risk</h2>
|
||||
<h2 id="security-risk">安全风险</h2>
|
||||
{$ doc.security | marked $}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%- if doc.see.length %}
|
||||
<section class="see-also">
|
||||
<h2>See also</h2>
|
||||
<h2 id="see-also">参见</h2>
|
||||
<ul>
|
||||
{% for see in doc.see %}
|
||||
<li>{$ see | marked $}</li>{% endfor %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%- if doc.selector %}
|
||||
<section class="selectors">
|
||||
<h2>Selectors</h2>
|
||||
<h2 id="selectors">选择器</h2>
|
||||
<code-example hideCopy="true" class="no-box api-heading selector">
|
||||
{%- for selector in doc.selector.split(',') %}
|
||||
{$ selector $}{% endfor %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% if doc.usageNotes %}
|
||||
<section class="usage-notes">
|
||||
<h2>Usage notes</h2>
|
||||
<h2 id="usage-notes">使用说明</h2>
|
||||
{$ doc.usageNotes | marked $}
|
||||
</section>
|
||||
{% endif %}
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
{% block overview %}{% include "includes/interface-overview.html" %}{% endblock %}
|
||||
{% block details %}
|
||||
{% include "includes/description.html" %}
|
||||
{$ memberHelper.renderProperties(doc.properties, 'instance-properties', 'instance-property', 'Properties') $}
|
||||
{$ memberHelper.renderMethodDetails(versionInfo, doc.methods, 'instance-methods', 'instance-method', 'Methods') $}
|
||||
{$ memberHelper.renderProperties(doc.properties, 'instance-properties', 'instance-property', '属性') $}
|
||||
{$ memberHelper.renderMethodDetails(versionInfo, doc.methods, 'instance-methods', 'instance-method', '方法') $}
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
<h2>{$ title $}</h2>
|
||||
{% for binding in bindings %}
|
||||
<div class="{$ cssItemClass $}">
|
||||
<code>{$ binding.bindingName $}</code> bound to <code>{$ binding.memberDoc.containerDoc.name $}.{$ binding.propertyName $}</code>
|
||||
<code>{$ binding.bindingName $}</code> 绑定到 <code>{$ binding.memberDoc.containerDoc.name $}.{$ binding.propertyName $}</code>
|
||||
{#{$ binding.memberDoc.description | trimBlankLines | marked $}#}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
{%- endmacro %}
|
||||
|
|
|
@ -13,7 +13,7 @@ https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInf
|
|||
|
||||
{% macro githubLinks(doc, versionInfo) -%}
|
||||
<div class="github-links">
|
||||
<a href="{$ githubEditHref(doc, versionInfo) $}" aria-label="Suggest Edits" title="Suggest Edits"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a>
|
||||
<a href="{$ githubViewHref(doc, versionInfo) $}" aria-label="View Source" title="View Source"><i class="material-icons" aria-hidden="true" role="img">code</i></a>
|
||||
<a href="{$ githubEditHref(doc, versionInfo) $}" aria-label="建议编辑" title="建议编辑"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a>
|
||||
<a href="{$ githubViewHref(doc, versionInfo) $}" aria-label="查看源码" title="查看源码"><i class="material-icons" aria-hidden="true" role="img">code</i></a>
|
||||
</div>
|
||||
{%- endmacro -%}
|
||||
{%- endmacro -%}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
{%- for ancestor in doc.extendsClauses %}{% if ancestor.doc %}
|
||||
|
||||
// inherited from <a class="code-anchor" href="{$ ancestor.doc.path $}">{$ ancestor.doc.id $}</a>{$ renderMembers(ancestor.doc) $}{% endif %}{% endfor -%}
|
||||
// 继承自 <a class="code-anchor" href="{$ ancestor.doc.path $}">{$ ancestor.doc.id $}</a>{$ renderMembers(ancestor.doc) $}{% endif %}{% endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro renderMemberSyntax(member, truncateLines) -%}
|
||||
|
@ -47,19 +47,19 @@
|
|||
|
||||
<code-example language="ts" hideCopy="true" linenums="false" class="no-box api-heading">{$ renderMemberSyntax(overload) $}</code-example>
|
||||
|
||||
<h4 class="no-anchor">Parameters</h4>
|
||||
<h4 class="no-anchor">参数</h4>
|
||||
{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter') $}
|
||||
|
||||
{% if overload.type or overload.returns.type %}
|
||||
<h4 class="no-anchor">Returns</h4>
|
||||
<h4 class="no-anchor">返回值</h4>
|
||||
{% marked %}`{$ (overload.type or overload.returns.type) $}`{% if overload.returns %}: {$ overload.returns.description $}{% endif %}{% endmarked %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if overload.throws.length %}
|
||||
<h4 class="no-anchor">Throws</h4>
|
||||
<h4 class="no-anchor">异常</h4>
|
||||
{% for error in overload.throws %}
|
||||
{% marked %}`{$ (error.typeList or 'Error') $}` {$ error.description $}{% endmarked %}
|
||||
{% marked %}`{$ (error.typeList or '错误') $}` {$ error.description $}{% endmarked %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
@ -76,8 +76,8 @@
|
|||
{% if method.name !== 'constructor' %}<thead><tr><th>
|
||||
<div class="with-github-links">
|
||||
<h3>
|
||||
{% if method.isCallMember %}<i>call signature</i>
|
||||
{% elseif method.isNewMember %}<i>construct signature</i>
|
||||
{% if method.isCallMember %}<i>调用签名</i>
|
||||
{% elseif method.isNewMember %}<i>构造函数签名</i>
|
||||
{% else %}{$ method.name $}()
|
||||
{% endif %}
|
||||
</h3>
|
||||
|
@ -108,7 +108,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<details class="overloads">
|
||||
<summary><h4 class="no-anchor">{$ method.overloads.length $} overloads...</h4></summary>
|
||||
<summary><h4 class="no-anchor">{$ method.overloads.length $} 的重载形式...</h4></summary>
|
||||
<div class="detail-contents">
|
||||
{% for overload in method.overloads %}
|
||||
{$ renderOverloadInfo(overload, cssClass + '-overload', method) $}
|
||||
|
@ -161,9 +161,9 @@
|
|||
<table class="is-full-width list-table property-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$ headings[0] or 'Property' $}</th>
|
||||
{% if hasTypes %}<th>{$ headings[1] or 'Type' $}</th>{% endif %}
|
||||
<th>{$ headings[2] or 'Description' $}</th>
|
||||
<th>{$ headings[0] or '属性名' $}</th>
|
||||
{% if hasTypes %}<th>{$ headings[1] or '类型' $}</th>{% endif %}
|
||||
<th>{$ headings[2] or '说明' $}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -172,10 +172,10 @@
|
|||
<td><a id="{$ property.anchor $}"></a>{$ property.name $}</td>
|
||||
{% if hasTypes %}<td><label class="property-type-label"><code>{$ property.type | escape $}</code></label></td>{% endif %}
|
||||
<td>
|
||||
{%- if (property.isGetAccessor or property.isReadonly) and not property.isSetAccessor %}<span class='read-only-property'>Read-only.</span>{% endif %}
|
||||
{%- if (property.isGetAccessor or property.isReadonly) and not property.isSetAccessor %}<span class='read-only-property'>只读</span>{% endif %}
|
||||
{% if property.shortDescription %}{$ property.shortDescription | marked $}{% endif %}
|
||||
{$ (property.description or property.constructorParamDoc.description) | marked $}
|
||||
{% if property.constructorParamDoc %} <span class='from-constructor'>Declared in constructor.</span>{% endif %}
|
||||
{% if property.constructorParamDoc %} <span class='from-constructor'>声明于构造函数中</span>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
|
||||
{% include "includes/see-also.html" %}
|
||||
|
||||
<h2>Entry points</h2>
|
||||
{$ listItems([doc.packageInfo.primary], 'Primary') $}
|
||||
{$ listItems(doc.packageInfo.secondary, 'Secondary') $}
|
||||
<h2 id="entry-points">入口点</h2>
|
||||
{$ listItems([doc.packageInfo.primary], '主要') $}
|
||||
{$ listItems(doc.packageInfo.secondary, '次要') $}
|
||||
|
||||
|
||||
<h2>Exports</h2>
|
||||
{$ listItems(doc.classes, 'Classes') $}
|
||||
{$ listItems(doc.decorators, 'Decorators') $}
|
||||
{$ listItems(doc.functions, 'Functions') $}
|
||||
{$ listItems(doc.structures, 'Structures') $}
|
||||
{$ listItems(doc.directives, 'Directives') $}
|
||||
{$ listItems(doc.pipes, 'Pipes') $}
|
||||
{$ listItems(doc.types, 'Types') $}
|
||||
<h2 id="exports">导出列表</h2>
|
||||
{$ listItems(doc.classes, '类') $}
|
||||
{$ listItems(doc.decorators, '装饰器') $}
|
||||
{$ listItems(doc.functions, '函数') $}
|
||||
{$ listItems(doc.structures, '结构') $}
|
||||
{$ listItems(doc.directives, '指令') $}
|
||||
{$ listItems(doc.pipes, '管道') $}
|
||||
{$ listItems(doc.types, '类型') $}
|
||||
{%- endblock %}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% import "api/lib/githubLinks.html" as github -%}
|
||||
{% import "api/lib/memberHelpers.html" as members -%}
|
||||
{% macro goToCode(doc) %}<a href="{$ github.githubViewHref(doc, versionInfo) $}" class="go-to-code" title="Go to source code"><i class="material-icons" aria-hidden="true" role="img">code</i></a>{% endmacro %}
|
||||
{% macro goToCode(doc) %}<a href="{$ github.githubViewHref(doc, versionInfo) $}" class="go-to-code" title="转到源码"><i class="material-icons" aria-hidden="true" role="img">code</i></a>{% endmacro %}
|
||||
{% macro label(test, class, text) %}{% if test %}<label class="{$ class $}">{$ text $}</label>{% endif %}{% endmacro %}
|
||||
{% macro renderLabels(doc) -%}
|
||||
{$ label(doc.notYetDocumented, 'no-doc', 'UNDOCUMENTED') $}
|
||||
{$ label(doc.notYetDocumented, 'no-doc', '尚无文档') $}
|
||||
{%- for tag in doc.tags.tags %}{$ label(tag.tagDef.deprecated, 'deprecated', '@' + tag.tagDef.name + ' deprecated') $}{% endfor %}
|
||||
{% endmacro %}
|
||||
{% macro renderMember(member) -%}
|
||||
|
@ -79,7 +79,7 @@
|
|||
<body>
|
||||
|
||||
|
||||
<h1>Documentation Status Report</h1>
|
||||
<h1 id="documentation-status-report">文档状态报告</h1>
|
||||
|
||||
{% for module in doc.modules %}
|
||||
<details>
|
||||
|
|
Loading…
Reference in New Issue