#!/usr/bin/env bash # # The Gemtexter blog engine and static site generator # by Paul Buetow 2021, 2022, 2023, 2024, 2025 declare -r ARG="$1"; shift declare CONTENT_FILTER="$1"; shift declare -r VERSION=3.0.1 declare -r VERSION_DESCR='develop' declare -r GEMTEXTER="Gemtexter $VERSION-$VERSION_DESCR" declare -r DATE_FORMAT='--iso-8601=seconds' declare DATE=date declare SED=sed declare GREP=grep declare XMLLINT='' declare SOURCE_HIGHLIGHT='' which gdate &>/dev/null && DATE=gdate which gsed &>/dev/null && SED=gsed which ggrep &>/dev/null && GREP=ggrep readonly DATE readonly SED readonly GREP # Set unset variables to make 'set -u' work, they can optionally be passed as # enviroments to Gemtexter test -z "$CONFIG_FILE_PATH" && CONFIG_FILE_PATH='' test -z "$GIT_COMMIT_MESSAGE" && GIT_COMMIT_MESSAGE='' test -z "$LOG_VERBOSE" && LOG_VERBOSE='' test -z "$PRE_GENERATE_HOOK" && PRE_GENERATE_HOOK='' test -z "$POST_PUBLISH_HOOK" && POST_PUBLISH_HOOK='' test -z "$MASTODON_URI" && MASTODON_URI='' test -z "$MARKDOWN_BASE_URI" && MARKDOWN_BASE_URI='' test -z "$SOURCE_HIGHLIGHT_CSS" && SOURCE_HIGHLIGHT_CSS='' set -euf -o pipefail if [[ -n "$CONFIG_FILE_PATH" ]]; then source "$CONFIG_FILE_PATH" elif [[ -f ~/.config/gemtexter.conf ]]; then source ~/.config/gemtexter.conf else source ./gemtexter.conf fi if [ -f "$HTML_THEME_DIR/theme.conf" ]; then source "$HTML_THEME_DIR/theme.conf" fi source ./lib/assert.source.sh source ./lib/atomfeed.source.sh source ./lib/gemfeed.source.sh source ./lib/generate.source.sh source ./lib/git.source.sh source ./lib/html.source.sh source ./lib/log.source.sh source ./lib/md.source.sh source ./lib/notes.source.sh source ./lib/template.source.sh help () { cat </dev/null; then log WARN "WARN, \"xmllint\" command is not installed, but it's recommended!" else export XMLLINT=xmllint fi if ! source-highlight --version &>/dev/null; then log WARN "WARN, GNU \"source-highlight\" command is not installed, but it's recommended!" else export SOURCE_HIGHLIGHT=source-highlight fi } setup () { if [ ! -d "$CONTENT_BASE_DIR" ]; then cat <