From 08f8e3b4a4879dd7c91c16fbce80c4f2bc5e357f Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 10 Jul 2023 02:32:24 +0000
Subject: [PATCH] docs + various polish
---
quartz/processors/filter.ts | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/quartz/processors/filter.ts b/quartz/processors/filter.ts
index e69de29..04c14a6 100644
--- a/quartz/processors/filter.ts
+++ b/quartz/processors/filter.ts
@@ -0,0 +1,23 @@
+import { PerfTimer } from "../perf"
+import { QuartzFilterPluginInstance } from "../plugins/types"
+import { ProcessedContent } from "../plugins/vfile"
+
+export function filterContent(plugins: QuartzFilterPluginInstance[], content: ProcessedContent[], verbose: boolean): ProcessedContent[] {
+ const perf = new PerfTimer()
+ const initialLength = content.length
+ for (const plugin of plugins) {
+ const updatedContent = content.filter(plugin.shouldPublish)
+
+ if (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