Skip to content

Commit

Permalink
#841 - Remove dash on folder notation
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Sep 18, 2024
1 parent 121a846 commit 47dba5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/commands/Article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ export class Article {

let newFileName = `${slugName}${ext}`;
if (filePrefix && typeof filePrefix === 'string') {
newFileName = `${filePrefix}-${newFileName}`;
if (filePrefix.endsWith('/')) {
newFileName = `${filePrefix}${newFileName}`;
} else {
newFileName = `${filePrefix}-${newFileName}`;
}
}

const newPath = editor.document.uri.fsPath.replace(fileName, newFileName);
Expand Down
6 changes: 5 additions & 1 deletion src/helpers/ArticleHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,11 @@ export class ArticleHelper {
// Create a folder with the `index.md` file
if (contentType?.pageBundle) {
if (prefix && typeof prefix === 'string') {
sanitizedName = `${prefix}-${sanitizedName}`;
if (prefix.endsWith('/')) {
sanitizedName = `${prefix}${sanitizedName}`;
} else {
sanitizedName = `${prefix}-${sanitizedName}`;
}
}

const newFolder = join(folderPath, sanitizedName);
Expand Down

0 comments on commit 47dba5f

Please sign in to comment.