summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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