summaryrefslogtreecommitdiff
path: root/http/bin
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-06-09 21:17:05 +0100
committerJoe Carstairs <me@joeac.net>2026-06-09 21:17:05 +0100
commit0065d36bc8dab85e639fa35945ef289f68182975 (patch)
treed23aa0e02ff1c3be95be1bf6e40ace3706081834 /http/bin
parent7a952de4f86b70cdced8d2af7024ce40b80cedf1 (diff)
blog script takes extract_args_cmd
Diffstat (limited to 'http/bin')
-rwxr-xr-xhttp/bin/blog9
-rwxr-xr-x[-rw-r--r--]http/bin/mkws0
2 files changed, 7 insertions, 2 deletions
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
index 91a8172..91a8172 100644..100755
--- a/http/bin/mkws
+++ b/http/bin/mkws