-
Notifications
You must be signed in to change notification settings - Fork 2
Fix editLink for products not accounting for orgName from repositories.json #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
5efdd92
2e05593
a6453c2
63ccb0a
816719e
718e717
f9a40a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ export default defineConfig({ | |
const repositoriesMap: Map<string, RepoData> = new Map(repositories.map((repoData: RepoData) => [repoData.repository, repoData])); | ||
|
||
const repoName = pageData.relativePath.split('/')[1]; | ||
const repoData = repositoriesMap.get(repoName); | ||
const repoData = repositoriesMap.get(repoName?.replace(/\d+-/g, '')); | ||
|
||
return { | ||
params: { | ||
|
@@ -157,19 +157,18 @@ export default defineConfig({ | |
const filePath = pageData.filePath | ||
const organization = pageData.params?.organization; | ||
|
||
const [_, repoName, ...rest] = filePath.split('/') | ||
const repoNamePath = repoName.replace(/\d+-/g, '') | ||
const restPath = rest.join('/') | ||
const orgName = organization || 'autumn-library'; | ||
|
||
if (filePath.startsWith('api/')) { | ||
return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/api/${restPath}` | ||
const [_, repoName, ...rest] = filePath.split('/') | ||
const restPath = rest.join('/') | ||
const orgName = organization || 'autumn-library'; | ||
return `https://github.com/${orgName}/${repoName}/edit/master/docs/api/${restPath}` | ||
} | ||
|
||
if (filePath.startsWith('products/')) { | ||
return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/product/${restPath}` | ||
} | ||
return '' | ||
// For products (after rewrites, products/ prefix is removed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. нене, вот здесь (и на 160 строке) как раз можно проверить relativePath. там же должно быть и /api и /product по идее. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed to use relativePath for path checks and restored common calculation of repoName, orgName and restPath as requested. Commit 718e717 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vitepress хостит не только /api и /product. Верни проверку на product обратно There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added back specific check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added back specific check for |
||
const [repoName, ...rest] = filePath.split('/') | ||
const restPath = rest.join('/') | ||
const orgName = organization || 'autumn-library'; | ||
return `https://github.com/${orgName}/${repoName}/edit/master/docs/product/${restPath}` | ||
} | ||
}, | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move replace to the line with repoName calculation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved replace operation inline with repoName calculation in both
transformPageData
andeditLink
pattern. Now usesrepoName?.replace(/\d+-/g, '')
directly in the assignment. Commit f9a40a6