From 8fd75ffbfda30edd5a134a1fbf9b81ac3cebb2ff Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 24 Jul 2023 00:42:00 +0000
Subject: [PATCH] support attachments folder
---
quartz/processors/filter.ts | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/quartz/processors/filter.ts b/quartz/processors/filter.ts
index e69de29..12c5b48 100644
--- a/quartz/processors/filter.ts
+++ b/quartz/processors/filter.ts
@@ -0,0 +1,27 @@
+import { BuildCtx } from "../ctx"
+import { PerfTimer } from "../perf"
+import { QuartzFilterPluginInstance } from "../plugins/types"
+import { ProcessedContent } from "../plugins/vfile"
+
+export function filterContent(
+ { cfg, argv }: BuildCtx,
+ content: ProcessedContent[],
+): ProcessedContent[] {
+ const perf = new PerfTimer()
+ const initialLength = content.length
+ for (const plugin of cfg.plugins.filters) {
+ const updatedContent = content.filter(plugin.shouldPublish)
+
+ if (argv.verbose) {
+ const diff = content.filter((x) => !updatedContent.includes(x))
+ for (const file of diff) {
+ console.log(`[filter:${plugin.name}] ${file[1].data.slug}`)
+ }
+ }
+
+ content = updatedContent
+ }
+
+ console.log(`Filtered out ${initialLength - content.length} files in ${perf.timeSince()}`)
+ return content
+}
--
Gitblit v1.10.0