From 4af1566f397edd9300178a842cb2ceb1a7f9bb25 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 25 Mar 2023 15:39:24 +0200 Subject: draft also generates .gmi files from draft templates --- README.md | 2 +- gemtexter | 1 + lib/generate.source.sh | 2 +- lib/template.source.sh | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7cb637..b4eb9de 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ Multiline template line 9 Multiline template line 10 ``` -Another thing you can do is to insert an index with links to similar blog posts. E.g.: +Another thing you can do is insert an index with links to similar blog posts. E.g.: ``` See more entries about DTail and Golang: diff --git a/gemtexter b/gemtexter index 25aa0a7..c60528b 100755 --- a/gemtexter +++ b/gemtexter @@ -157,6 +157,7 @@ main () { echo "This is gemtexter version $VERSION $VERSION_DESCR" ;; --draft) + template::draft generate::draft html md ;; --publish) diff --git a/lib/generate.source.sh b/lib/generate.source.sh index 4ce1600..7c6d49d 100644 --- a/lib/generate.source.sh +++ b/lib/generate.source.sh @@ -187,7 +187,7 @@ generate::fromgmi () { # Only generate draft posts generate::draft () { - if [ -n "$CONTENT_FILTER" ]; then + if [[ -n "$CONTENT_FILTER" && "$CONTENT_FILTER" != DRAFT- ]]; then log ERROR "ERROR, you can't set a content filter manually in draft mode" exit 2 fi diff --git a/lib/template.source.sh b/lib/template.source.sh index ec49490..204078d 100644 --- a/lib/template.source.sh +++ b/lib/template.source.sh @@ -14,6 +14,11 @@ template::generate () { log INFO "Converted $num_tpl_files template files" } +template::draft () { + CONTENT_FILTER=DRAFT- + template::generate +} + template::_generate_file () { local -r tpl_path="$1"; shift local -r tpl_dir="$(dirname "$tpl_path")" -- cgit v1.2.3