summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-03-25 15:39:24 +0200
committerPaul Buetow <paul@buetow.org>2023-03-25 15:39:24 +0200
commit4af1566f397edd9300178a842cb2ceb1a7f9bb25 (patch)
tree9828f215c0c0439ec69ee361614e5ebc190ea04f
parent9ad249a38a07f57c1bb9d14302ea59d478d9f6b8 (diff)
draft also generates .gmi files from draft templates
-rw-r--r--README.md2
-rwxr-xr-xgemtexter1
-rw-r--r--lib/generate.source.sh2
-rw-r--r--lib/template.source.sh5
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")"