diff options
| author | Paul Buetow <paul@buetow.org> | 2023-03-25 15:39:24 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-03-25 15:39:24 +0200 |
| commit | 4af1566f397edd9300178a842cb2ceb1a7f9bb25 (patch) | |
| tree | 9828f215c0c0439ec69ee361614e5ebc190ea04f | |
| parent | 9ad249a38a07f57c1bb9d14302ea59d478d9f6b8 (diff) | |
draft also generates .gmi files from draft templates
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | gemtexter | 1 | ||||
| -rw-r--r-- | lib/generate.source.sh | 2 | ||||
| -rw-r--r-- | lib/template.source.sh | 5 |
4 files changed, 8 insertions, 2 deletions
@@ -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: @@ -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")" |
