2017-07-13 12:07:49 -04:00
|
|
|
/**
|
|
|
|
* Members that have overloads get long unwieldy anchors because they must be distinguished
|
|
|
|
* by their parameter lists.
|
|
|
|
* But the primary overload doesn't not need this distinction, so can just be the name of the member.
|
|
|
|
*/
|
|
|
|
module.exports = function simplifyMemberAnchors() {
|
|
|
|
return {
|
2018-02-28 09:52:53 -05:00
|
|
|
$runAfter: ['paths-computed'],
|
|
|
|
$runBefore: ['rendering-docs'],
|
2017-07-13 12:07:49 -04:00
|
|
|
$process: function(docs) {
|
|
|
|
return docs.forEach(doc => {
|
|
|
|
if (doc.members) {
|
2018-02-28 09:52:53 -05:00
|
|
|
doc.members.forEach(member => {
|
|
|
|
member.anchor = computeAnchor(member);
|
|
|
|
member.path = doc.path + '#' + member.anchor;
|
|
|
|
});
|
2017-07-13 12:07:49 -04:00
|
|
|
}
|
|
|
|
if (doc.statics) {
|
2018-02-28 09:52:53 -05:00
|
|
|
doc.statics.forEach(member => {
|
|
|
|
member.anchor = computeAnchor(member);
|
|
|
|
member.path = doc.path + '#' + member.anchor;
|
|
|
|
});
|
2017-07-13 12:07:49 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
function computeAnchor(member) {
|
|
|
|
// if the member is a "call" type then it has no name
|
|
|
|
return encodeURI(member.name.trim() || 'call');
|
|
|
|
}
|