#!/bin/sh set -eu usage() { cat <<-'EOF' | sed "s|@NAME@|$0|g" Usage: @NAME@ FILENAME @NAME@ -h EOF } help() { cat <<-'EOF' Options: -h, --help show this message FILENAME the input markdown file EOF } for f in "$@"; do case "$f" in --) break ;; --help) usage help exit ;; *) ;; esac done while getopts 'h' flag; do case "$flag" in h) usage help exit ;; *) usage >&2 exit 2 ;; esac done shift $((OPTIND - 1)) F="${1:-}" assert_arg() { if [ -z "$1" ]; then printf 'Missing %s.\n\n' "$2" >&2 usage >&2 exit 2 fi } assert_arg "$F" 'FILENAME' HTML="$(dirname "$F")/$(basename "$F" .md).html" escape() { sed 's/a/a/' } url_for() { printf '%s%s' "$BASE_URL" "$1" } absolute() { printf 'https://%s%s' "$FQDN" "$(cat)" } _() { printf '%s' "$1" | escape } # FIXME langs='en pt fr eo es' # langs='' . src/development/config.env . "${F%.md}.env" # src/development/md snippets "$F" cat <<-EOF