Skip to content

Commit

Permalink
chore(git-changelog): fix incompleted rewrite
Browse files Browse the repository at this point in the history
Signed-off-by: Neko Ayaka <[email protected]>
  • Loading branch information
nekomeowww committed Dec 31, 2023
1 parent efa4025 commit 4fdbda6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/vitepress-plugin-git-changelog/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nolebase/vitepress-plugin-git-changelog",
"type": "module",
"version": "1.3.0",
"version": "1.3.1",
"description": "A VitePress plugin that adds a changelog fetched from git to your documentation.",
"author": {
"name": "Nólëbase",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export function useRawPath() {
let path = decodeURIComponent(route.path).toLowerCase()
if (path.endsWith('/'))
path += 'index.md'

else
path = path.replace(/^\/(.+?)(\.html)?$/s, '$1.md')

Expand Down
8 changes: 5 additions & 3 deletions packages/vitepress-plugin-git-changelog/src/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ export function GitChangelog(options: {
)

// rewrite paths
for (const [index, file] of log.path.entries()) {
for (const [index, files] of log.path.entries()) {
for (const [key, value] of Object.entries(rewritePaths)) {
if (file[1].startsWith(key))
log.path[index][1] = file[1].replace(key, value)
if (files[1] && files[1].startsWith(key))
log.path[index][1] = files[1].replace(key, value)
if (files[2] && files[2].startsWith(key))
log.path[index][2] = files[2].replace(key, value)
}
}

Expand Down

0 comments on commit 4fdbda6

Please sign in to comment.