chore(doc-gen/angular.io): add ids to members so they can be linked to
Closes #4206
This commit is contained in:
parent
241632aaa1
commit
34aa1425b7
|
@ -58,7 +58,10 @@ module.exports = new Package('angular.io', [basePackage])
|
||||||
|
|
||||||
|
|
||||||
.config(function(templateEngine, getInjectables) {
|
.config(function(templateEngine, getInjectables) {
|
||||||
templateEngine.filters = templateEngine.filters.concat(getInjectables([require('./rendering/trimBlankLines')]));
|
templateEngine.filters = templateEngine.filters.concat(getInjectables([
|
||||||
|
require('./rendering/trimBlankLines'),
|
||||||
|
require('./rendering/toId')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
module.exports = function() {
|
||||||
|
return {
|
||||||
|
name: 'toId',
|
||||||
|
process: function(str) {
|
||||||
|
return str.replace(/[^(a-z)(A-Z)(0-9)._-]/, '-');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -29,7 +29,7 @@ p.location-badge.
|
||||||
|
|
||||||
{%- if doc.constructorDoc %}
|
{%- if doc.constructorDoc %}
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
h3 {$ doc.constructorDoc.name $}
|
h3#{$ doc.constructorDoc.name | toId $} {$ doc.constructorDoc.name $}
|
||||||
|
|
||||||
{% if doc.constructorDoc.parameters %}
|
{% if doc.constructorDoc.parameters %}
|
||||||
pre.prettyprint
|
pre.prettyprint
|
||||||
|
@ -44,7 +44,7 @@ p.location-badge.
|
||||||
|
|
||||||
{%- for member in doc.members %}{% if not member.private %}
|
{%- for member in doc.members %}{% if not member.private %}
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
h3 {$ member.name $}{% if member.optional %}?{% endif %}
|
h3#{$ member.name | toId $} {$ member.name $}{% if member.optional %}?{% endif %}
|
||||||
|
|
||||||
{% if member.parameters %}
|
{% if member.parameters %}
|
||||||
pre.prettyprint
|
pre.prettyprint
|
||||||
|
|
Loading…
Reference in New Issue