Fixed issue where file name cannot be parsed
This commit is contained in:
parent
9cdde4be3e
commit
47d0eb25ba
@ -125,8 +125,13 @@ export const Transformer = {
|
||||
},
|
||||
/* Parse file name from path then sanitize it */
|
||||
parseFileNameFromPath: function (filepath) {
|
||||
if (typeof filepath ==='string' && filepath.includes("/")) {
|
||||
const parsedFileFromPath = filepath.split("/")[filepath.split("/").length - 1]
|
||||
return parsedFileFromPath.replace(".md", "")
|
||||
} else {
|
||||
console.log("Failed: CANNOT Parse" + filepath)
|
||||
return null
|
||||
}
|
||||
},
|
||||
/* Pair provided and existing Filenames*/
|
||||
getInternalLinks: function (aFilePath) {
|
||||
|
@ -61,7 +61,7 @@ export function toFilePath(slug) {
|
||||
} else {
|
||||
filePath = Node.getMarkdownFolder() + slug
|
||||
.replaceAll('__', '/')
|
||||
.replaceAll('--', ' ')
|
||||
.replaceAll('++++', ' ')
|
||||
.replaceAll('ambersand', '&')
|
||||
+ ".md";
|
||||
}
|
||||
@ -79,7 +79,7 @@ export function toSlug(filePath) {
|
||||
if (Node.isFile(filePath) && filePath.includes(Node.getMarkdownFolder())) {
|
||||
return filePath.replace(Node.getMarkdownFolder(), '')
|
||||
.replaceAll('/', '__')
|
||||
.replaceAll(' ', '--')
|
||||
.replaceAll(' ', '++++')
|
||||
.replaceAll('&', 'ambersand')
|
||||
.replace('.md', '')
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user