From 6da3ddb5dd56551d5d7703b71c01844f53b0e1b3 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 20 Dec 2021 20:38:56 +0100 Subject: [PATCH] #206 - Removal of the front matter parsing error notification --- src/helpers/ArticleHelper.ts | 22 +++------------------- src/helpers/CustomScript.ts | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/helpers/ArticleHelper.ts b/src/helpers/ArticleHelper.ts index 6a2f22f6..1304218f 100644 --- a/src/helpers/ArticleHelper.ts +++ b/src/helpers/ArticleHelper.ts @@ -35,9 +35,9 @@ export class ArticleHelper { * Retrieve the file's front matter by its path * @param filePath */ - public static getFrontMatterByPath(filePath: string, surpressNotification: boolean = false) { + public static getFrontMatterByPath(filePath: string) { const file = fs.readFileSync(filePath, { encoding: "utf-8" }); - return ArticleHelper.parseFile(file, filePath, surpressNotification); + return ArticleHelper.parseFile(file, filePath); } /** @@ -228,10 +228,9 @@ export class ArticleHelper { * @param fileContents * @returns */ - private static parseFile(fileContents: string, fileName: string, surpressNotification: boolean = false): matter.GrayMatterFile | null { + private static parseFile(fileContents: string, fileName: string): matter.GrayMatterFile | null { try { const commaSeparated = Settings.get(SETTING_COMMA_SEPARATED_FIELDS); - const diagnostics: Diagnostic[] = []; if (fileContents) { const language: string = getFmLanguage(); @@ -288,21 +287,6 @@ export class ArticleHelper { }]); } } - - if (!surpressNotification) { - if (this.notifiedFiles.indexOf(fileName) === -1) { - Notifications.error(`There seems to be an issue parsing the content its front matter. FileName: ${basename(fileName)}. ERROR: ${error.message || error}`, ...items).then((result: any) => { - if (result?.title) { - const item = items.find(i => i.title === result.title); - if (item) { - item.action(); - } - } - }); - - this.notifiedFiles.push(fileName); - } - } } return null; } diff --git a/src/helpers/CustomScript.ts b/src/helpers/CustomScript.ts index 1d06e679..ad0501f0 100644 --- a/src/helpers/CustomScript.ts +++ b/src/helpers/CustomScript.ts @@ -67,7 +67,7 @@ export class CustomScript { if (folder.lastModified.length > 0) { for await (const file of folder.lastModified) { try { - const article = ArticleHelper.getFrontMatterByPath(file.filePath, true); + const article = ArticleHelper.getFrontMatterByPath(file.filePath); if (article) { const crntOutput = await CustomScript.runScript(wsPath, article, file.filePath, script); if (crntOutput) {