Skip to content

Commit

Permalink
Change prettyname of classes
Browse files Browse the repository at this point in the history
Now also includes the class name if it is different than its module name.
`ol/source/Vector` -> `ol/source/Vector~VectorSource`.
  • Loading branch information
MoonE committed Feb 21, 2020
1 parent 7640bcd commit 8b857ee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions config/jsdoc/api/template/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,15 @@ function attachModuleSymbols(doclets, modules) {
}

function getPrettyName(longname) {
return longname
.split('~')[0]
.replace('module:', '');
const fullname = longname.replace('module:', '');
const parts = fullname.split(/[~\.]/);
if (parts.length > 1) {
const pathParts = parts[0].split('/');
if (parts[parts.length - 1] === pathParts[pathParts.length - 1]) {
return parts[0];
}
}
return fullname;
}

/**
Expand Down

0 comments on commit 8b857ee

Please sign in to comment.