From 0065d36bc8dab85e639fa35945ef289f68182975 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 9 Jun 2026 21:17:05 +0100 Subject: [PATCH] blog script takes extract_args_cmd --- http/bin/blog | 9 +++++++-- http/bin/mkws | 0 2 files changed, 7 insertions(+), 2 deletions(-) mode change 100644 => 100755 http/bin/mkws diff --git a/http/bin/blog b/http/bin/blog index 5fdd12c..49bef7f 100755 --- a/http/bin/blog +++ b/http/bin/blog @@ -7,10 +7,14 @@ export LAYOUTS="$(realpath share/layouts)" usage() { >&2 cat << USAGE -usage: blog -i LOG [-p POSTPROCESS_CMD] [-l LAYOUT] [-t] +usage: blog -i LOG [-p POSTPROCESS_CMD] [-a EXTRACT_ARGS_CMD] [-l LAYOUT] [-t] options: + -a EXTRACT_ARGS_CMD + If provided, a shell command to extract arguments to the layout from the + source files. The shell will be provided with a variable, POST_TITLE. + -i LOG The name of the source directory under \$BLOGS where log posts live. @@ -27,6 +31,7 @@ options: USAGE } +extract_args_cmd="head -n 0 | echo \"POST_TITLE=\\\"\${POST_TITLE}\\\"\"" log_name="" layout="default" postprocess_cmd="echo" @@ -92,6 +97,6 @@ do export POST_TITLE="$title" cat "$entry" | grep --regexp "^\# " --invert-match | eval "$postprocess_cmd" > "$dest" fi - echo "POST_TITLE=\"$(echo "${title}" | sed "s/\\\"/\\\\\"/g")\"" > "${dest}.args" + cat "$entry" | eval "$extract_args_cmd" > "${dest}.args" echo "Processed ${entry#$(dirname ${BLOGS})/} to ${dest#$(dirname ${SRC})/}" done diff --git a/http/bin/mkws b/http/bin/mkws old mode 100644 new mode 100755