Skip to content

Commit

Permalink
fix issue with module names having /
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Dec 2, 2022
1 parent b244bd0 commit 18eac14
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions prember-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ const { readdirSync, readFileSync } = require('fs');
const cmp = require('semver-compare');
const semver = require('semver');

function partialUrlEncode(input) {
return input.replace('/', '%2F');
}

module.exports = function () {
const projects = readdirSync('ember-api-docs-data/json-docs');

Expand Down Expand Up @@ -67,9 +71,19 @@ module.exports = function () {
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}`);

// TODO only include sub routes if that entity has stuff in that route i.e. if it's empty don't pre-render it
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}/methods`);
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}/properties`);
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}/events`);
urls.push(
`/${p}/${uniqVersion}/${entity}/${partialUrlEncode(
cleanId
)}/methods`
);
urls.push(
`/${p}/${uniqVersion}/${entity}/${partialUrlEncode(
cleanId
)}/properties`
);
urls.push(
`/${p}/${uniqVersion}/${entity}/${partialUrlEncode(cleanId)}/events`
);

if (entity === 'modules') {
// id is
Expand All @@ -93,9 +107,8 @@ module.exports = function () {

listOfFunctions.forEach((func) => {
urls.push(
`/${p}/${uniqVersion}/functions/${cleanId.replace(
'/',
'%2F'
`/${p}/${uniqVersion}/functions/${partialUrlEncode(
cleanId
)}/${func.name}`
);
});
Expand Down

0 comments on commit 18eac14

Please sign in to comment.