fix(api-builder): pass versionInfo to macros
The update to dgeni-packages led to a breaking change in the Nunjucks templates, where macros are now isolated from their calling site. This means that we must pass the `versionInfo` object through to the macro rather than expecting it to be in scope already.
This commit is contained in:
parent
37953e8a06
commit
9c55afdfde
@ -140,6 +140,6 @@ div(layout="row" layout-xs="column" class="instance-members" class="row-margin n
|
|||||||
|
|
||||||
p(class="location-badge").
|
p(class="location-badge").
|
||||||
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} },
|
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} },
|
||||||
defined in {$ github.githubViewLink(doc) $}
|
defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -46,6 +46,6 @@ div(layout="row" layout-xs="column" class="metadata" class="row-margin ng-cloak"
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
p.location-badge.
|
p.location-badge.
|
||||||
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ github.githubViewLink(doc) $}
|
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -26,6 +26,6 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak")
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
p.location-badge.
|
p.location-badge.
|
||||||
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ github.githubViewLink(doc) $}
|
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -68,6 +68,6 @@ div(layout="row" layout-xs="column" class="instance-members" class="row-margin n
|
|||||||
|
|
||||||
p(class="location-badge").
|
p(class="location-badge").
|
||||||
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} },
|
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} },
|
||||||
defined in {$ github.githubViewLink(doc) $}
|
defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% macro githubHref(doc) -%}
|
{% macro githubHref(doc, versionInfo) -%}
|
||||||
https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/modules/{$ doc.fileInfo.projectRelativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}
|
https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/modules/{$ doc.fileInfo.projectRelativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro githubViewLink(doc) -%}
|
{% macro githubViewLink(doc, versionInfo) -%}
|
||||||
<a href="{$ githubHref(doc) $}">{$ doc.fileInfo.projectRelativePath $}</a>
|
<a href="{$ githubHref(doc, versionInfo) $}">{$ doc.fileInfo.projectRelativePath $}</a>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% block body -%}
|
{% block body -%}
|
||||||
include {$ relativePath(doc.path, '_util-fns') $}
|
include {$ relativePath(doc.path, '_util-fns') $}
|
||||||
p.location-badge.
|
p.location-badge.
|
||||||
defined in {$ github.githubViewLink(doc) $}
|
defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
ul
|
ul
|
||||||
{% for page in doc.childPages -%}
|
{% for page in doc.childPages -%}
|
||||||
|
@ -47,20 +47,20 @@
|
|||||||
|
|
||||||
{% for export in module.exports %}
|
{% for export in module.exports %}
|
||||||
<h3 {% if export.notYetDocumented %}class="not-documented"{% endif %}>
|
<h3 {% if export.notYetDocumented %}class="not-documented"{% endif %}>
|
||||||
<a href="{$ github.githubHref(export) $}">
|
<a href="{$ github.githubHref(export, versionInfo) $}">
|
||||||
<code>{$ export.docType $} {$ export.name $}</code>
|
<code>{$ export.docType $} {$ export.name $}</code>
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
{%- if export.constructorDoc %}
|
{%- if export.constructorDoc %}
|
||||||
<h4 {% if export.constructorDoc.notYetDocumented %}class="not-documented"{% endif %}>
|
<h4 {% if export.constructorDoc.notYetDocumented %}class="not-documented"{% endif %}>
|
||||||
<a href="{$ github.githubHref(export.constructorDoc) $}">
|
<a href="{$ github.githubHref(export.constructorDoc, versionInfo) $}">
|
||||||
<code>{$ export.constructorDoc.name $}{$ params.paramList(export.constructorDoc.params) $}</code>
|
<code>{$ export.constructorDoc.name $}{$ params.paramList(export.constructorDoc.params) $}</code>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{%- for member in export.members %}
|
{%- for member in export.members %}
|
||||||
<h4 {% if member.notYetDocumented %}class="not-documented"{% endif %}>
|
<h4 {% if member.notYetDocumented %}class="not-documented"{% endif %}>
|
||||||
<a href="{$ github.githubHref(member) $}">
|
<a href="{$ github.githubHref(member, versionInfo) $}">
|
||||||
<code>{$ member.name $}{$ params.paramList(member.params) $}</code>
|
<code>{$ member.name $}{$ params.paramList(member.params) $}</code>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
@ -24,6 +24,6 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak")
|
|||||||
|
|
||||||
p(class="location-badge").
|
p(class="location-badge").
|
||||||
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
|
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
|
||||||
defined in {$ github.githubViewLink(doc) $}
|
defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -27,6 +27,6 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak")
|
|||||||
|
|
||||||
p.location-badge.
|
p.location-badge.
|
||||||
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
|
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
|
||||||
defined in {$ github.githubViewLink(doc) $}
|
defined in {$ github.githubViewLink(doc, versionInfo) $}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1 class="id">{$ doc.id $} <span class="type">module</span></h1>
|
<h1 class="id">{$ doc.id $} <span class="type">module</span></h1>
|
||||||
<p>defined in {$ github.githubViewLink(doc) $}</p>
|
<p>defined in {$ github.githubViewLink(doc, versionInfo) $}</p>
|
||||||
<p>{$ doc.description | marked $}</p>
|
<p>{$ doc.description | marked $}</p>
|
||||||
|
|
||||||
{% if doc.exports.length %}
|
{% if doc.exports.length %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user