diff options
| author | Paul Buetow <paul@buetow.org> | 2022-11-23 20:45:21 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-11-23 20:45:21 +0200 |
| commit | 5bbae36a59881e34fe111c0ee9f44f3907158301 (patch) | |
| tree | 85d2b8da1f33c327f57def0ba31a178872050a3d /lib/generate.source.sh | |
| parent | 6682bd7c4c45283acdb161765dac58ec034899bd (diff) | |
| parent | 4c4f379ea616eeec320ec27776c739fadf70d2da (diff) | |
merge
Diffstat (limited to 'lib/generate.source.sh')
| -rw-r--r-- | lib/generate.source.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/generate.source.sh b/lib/generate.source.sh index b2dafbc..9a9e90b 100644 --- a/lib/generate.source.sh +++ b/lib/generate.source.sh @@ -63,6 +63,10 @@ generate::convert_gmi_atom_to_html_atom () { return fi + if [ ! -f "$CONTENT_BASE_DIR/gemtext/gemfeed/atom.xml" ]; then + return + fi + log INFO 'Converting Gemtext Atom feed to HTML Atom feed' $SED 's|.gmi|.html|g; s|gemini://|https://|g' \ @@ -124,6 +128,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 @@ -176,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 +} |
