summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-07-30 11:55:38 +0100
committerPaul Buetow <paul@buetow.org>2022-07-30 11:55:38 +0100
commit0064164a5e5e3435cf2a7fb484be9761fc974691 (patch)
treeb7dea8354f43ce722180a04486ac928cbfd22210
parenta2e70af791382c5b90c04588ef1f767e433e4d08 (diff)
rewording and actually add filter code
-rw-r--r--README.md2
-rw-r--r--lib/generate.source.sh5
2 files changed, 6 insertions, 1 deletions
diff --git a/README.md b/README.md
index 34a1675..8fb50cb 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ It is up to you to set up a Gemini server for the Gemtext, a Webserver for the H
## Content filter
-Once your capsule reaches a certain size it can become anoying to re-generate everything if you only want to modify one single Gemtext file. The following will add a filter to only generate the files matching a regular expression:
+Once your capsule reaches a certain size it can become anoying to re-generate everything if you only want to preview one single content file. The following will add a filter to only generate the files matching a regular expression:
```
./gemtexter --generate '.*hello.*'
diff --git a/lib/generate.source.sh b/lib/generate.source.sh
index b2dafbc..f72f84b 100644
--- a/lib/generate.source.sh
+++ b/lib/generate.source.sh
@@ -124,6 +124,11 @@ generate::fromgmi () {
# Add content
while read -r src; do
+ # User can specify a content filter
+ if test ! -z "$CONTENT_FILTER" && ! $GREP -q "$CONTENT_FILTER" <<< "$src"; then
+ continue
+ fi
+
num_gmi_files=$(( num_gmi_files + 1 ))
log INFO "Generating output formats from $src"
for format in "$@"; do