From c70afc1b6393530ba8b1301e7a62fe539fe2d1e5 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 14:14:51 +0000 Subject: [PATCH] feat: Updated src/jekyll/chirpy.ts --- src/jekyll/chirpy.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/jekyll/chirpy.ts b/src/jekyll/chirpy.ts index 7649b5fd..ff3574c9 100644 --- a/src/jekyll/chirpy.ts +++ b/src/jekyll/chirpy.ts @@ -98,13 +98,17 @@ async function validateSettings(plugin: O2Plugin) { } } -function getFilesInReady(plugin: O2Plugin): TFile[] { +function getFilesToPublish(plugin: O2Plugin): TFile[] { + const frontMatterConverter = new FrontMatterConverter(); return plugin.app.vault.getMarkdownFiles() - .filter((file: TFile) => file.path.startsWith(plugin.settings.readyFolder)); + .filter((file: TFile) => { + const frontMatter = frontMatterConverter.getFrontMatter(file); + return frontMatter.publish === true; + }); } async function backupOriginalNotes(plugin: O2Plugin) { - const readyFiles = getFilesInReady.call(this, plugin); + const readyFiles = getFilesToPublish.call(this, plugin); const backupFolder = plugin.settings.backupFolder; const readyFolder = plugin.settings.readyFolder; readyFiles.forEach((file: TFile) => { @@ -115,7 +119,7 @@ async function backupOriginalNotes(plugin: O2Plugin) { // FIXME: SRP, renameMarkdownFile(file: TFile): string async function renameMarkdownFile(plugin: O2Plugin): Promise { const dateString = Temporal.Now.plainDateISO().toString(); - const markdownFiles = getFilesInReady.call(this, plugin); + const markdownFiles = getFilesToPublish.call(this, plugin); for (const file of markdownFiles) { const newFileName = dateString + '-' + file.name; const newFilePath = file.path