build(aio): render the `extends` ancestors of classes in API docs (#18927)

PR Close #18927
This commit is contained in:
Peter Bacon Darwin 2017-08-28 17:46:32 +01:00 committed by Miško Hevery
parent dc7de0896c
commit 35bc1eb218
4 changed files with 15 additions and 9 deletions

View File

@ -82,7 +82,7 @@
"concurrently": "^3.4.0", "concurrently": "^3.4.0",
"cross-spawn": "^5.1.0", "cross-spawn": "^5.1.0",
"dgeni": "^0.4.7", "dgeni": "^0.4.7",
"dgeni-packages": "^0.20.0", "dgeni-packages": "^0.21.0",
"entities": "^1.1.1", "entities": "^1.1.1",
"eslint": "^3.19.0", "eslint": "^3.19.0",
"eslint-plugin-jasmine": "^2.2.0", "eslint-plugin-jasmine": "^2.2.0",

View File

@ -5,9 +5,8 @@
<code-example language="ts" hideCopy="true"> <code-example language="ts" hideCopy="true">
{$ doc.docType $} {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHeritage(doc) $} { {$ doc.docType $} {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHeritage(doc) $} {
{%- if doc.statics.length %}{% for member in doc.statics %}{% if not member.internal %} {%- if doc.statics.length %}{% for member in doc.statics %}{% if not member.internal %}
<a class="code-anchor" href="#{$ member.anchor $}">{$ memberHelper.renderMember(member, 1) $}</a>{% endif %}{% endfor %}{% endif %} <a class="code-anchor" href="#{$ member.anchor $}">{$ memberHelper.renderMember(member, 1) $}</a>{% endif %}{% endfor %}{% endif -%}
{%- if doc.members.length %}{% for member in doc.members %}{% if not member.internal %} {$ memberHelper.renderMembers(doc) $}
<a class="code-anchor" href="#{$ member.anchor $}">{$ memberHelper.renderMember(member, 1) $}</a>{% endif %}{% endfor %}{% endif %}
} }
</code-example> </code-example>
</section> </section>

View File

@ -2,13 +2,20 @@
{%- macro renderHeritage(exportDoc) -%} {%- macro renderHeritage(exportDoc) -%}
{%- if exportDoc.extendsClauses.length %} extends {% for clause in exportDoc.extendsClauses -%} {%- if exportDoc.extendsClauses.length %} extends {% for clause in exportDoc.extendsClauses -%}
{$ clause $}{% if not loop.last %}, {% endif -%} <a class="code-anchor" href="{$ clause.doc.path $}">{$ clause.text $}</a>{% if not loop.last %}, {% endif -%}
{% endfor %}{% endif %} {% endfor %}{% endif %}
{%- if exportDoc.implementsClauses.length %} implements {% for clause in exportDoc.implementsClauses -%} {%- if exportDoc.implementsClauses.length %} implements {% for clause in exportDoc.implementsClauses -%}
{$ clause $}{% if not loop.last %}, {% endif -%} <a class="code-anchor" href="{$ clause.doc.path $}">{$ clause.text $}</a>{% if not loop.last %}, {% endif -%}
{% endfor %}{% endif %} {% endfor %}{% endif %}
{%- endmacro -%} {%- endmacro -%}
{%- macro renderMembers(doc) -%}
{%- if doc.members.length %}{% for member in doc.members %}{% if not member.internal %}
<a class="code-anchor" href="{$ doc.path $}#{$ member.anchor $}">{$ renderMember(member, 1) $}</a>{% endif %}{% endfor %}{% endif %}
{%- 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 %}
{%- endmacro -%}
{%- macro renderMember(member, truncateLines) -%} {%- macro renderMember(member, truncateLines) -%}
{%- if member.accessibility !== 'public' %}{$ member.accessibility $} {% endif -%} {%- if member.accessibility !== 'public' %}{$ member.accessibility $} {% endif -%}
{%- if member.isGetAccessor %}get {% endif -%} {%- if member.isGetAccessor %}get {% endif -%}

View File

@ -2002,9 +2002,9 @@ devtools-timeline-model@1.1.6:
chrome-devtools-frontend "1.0.401423" chrome-devtools-frontend "1.0.401423"
resolve "1.1.7" resolve "1.1.7"
dgeni-packages@^0.20.0: dgeni-packages@^0.21.0:
version "0.20.0" version "0.21.0"
resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.20.0.tgz#e7da99b0a119ee2eb584202d054a5aa01f23e208" resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.21.0.tgz#5b62ec238fb12ae802e73fdd674f07a7cfd98925"
dependencies: dependencies:
canonical-path "0.0.2" canonical-path "0.0.2"
catharsis "^0.8.1" catharsis "^0.8.1"