diff options
| author | Paul Buetow <paul@buetow.org> | 2022-11-20 10:22:00 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-11-20 10:22:00 +0000 |
| commit | 4bf2c17e3f647ebf004b2a1ca5e6eb682e4ad966 (patch) | |
| tree | 3ff11188cdacbb1a49c7fc3e7f4a1c2a6f209f01 | |
| parent | e9044cd87daabcb83522a68732e0b96189baf854 (diff) | |
add --draft switch
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | gemtexter | 5 | ||||
| -rw-r--r-- | lib/generate.source.sh | 13 |
3 files changed, 18 insertions, 2 deletions
@@ -93,7 +93,7 @@ You can also have a look at `$BASE_CONTENT_DIR/meta/gemfeed`. There is a metafil ## Drafting a blog post before publishing it -If you don't want to publish your article yet (e.g. don't advertise it on the Gemfeed and Atom feed yet), you can draft your article in `./gemtext/gemfeed/DRAFT-article-title-dash-separated.gmi`. Gemtexter will still generate all output formats of the draft, but your site visitors won't be aware of it. Once you want to publish your draft just rename `DRAFT` with the publishing date `YYYY-MM-DD` and from there everything works normally. +If you don't want to publish your article yet (e.g. don't advertise it on the Gemfeed and Atom feed yet), you can draft your article in `./gemtext/gemfeed/DRAFT-article-title-dash-separated.gmi` and when invoke `./gemtexter --draft` to generate the outputs. Once you want to publish your draft just rename `DRAFT` with the publishing date `YYYY-MM-DD` and from there everything works normally. ## Ready to be published @@ -4,7 +4,7 @@ # by Paul Buetow 2021, 2022 declare -r ARG="$1"; shift -declare -r CONTENT_FILTER="$1"; shift +declare CONTENT_FILTER="$1"; shift declare -r VERSION=1.2.0 declare -r VERSION_DESCR=develop @@ -131,6 +131,9 @@ main () { --version) echo "This is gemtexter version $VERSION $VERSION_DESCR" ;; + --draft) + generate::draft html md + ;; --publish) $0 --generate $0 --git diff --git a/lib/generate.source.sh b/lib/generate.source.sh index 5392163..9a9e90b 100644 --- a/lib/generate.source.sh +++ b/lib/generate.source.sh @@ -185,3 +185,16 @@ generate::fromgmi () { done log INFO "You may want to commit all changes to version control!" } + +# Only generate draft posts +generate::draft () { + if [ ! -z "$CONTENT_FILTER" ]; then + log ERROR "ERROR, you can't set a content filter manually in draft mode" + exit 2 + fi + CONTENT_FILTER=DRAFT- + generate::fromgmi $@ + + log INFO 'For HTML preview, open in your browser:' + find $CONTENT_BASE_DIR/html -name DRAFT-\*.html +} |
