diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-06-18 23:15:07 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-06-18 23:15:07 +0200 |
commit | afe42d9600842ba565cf66c043cd11b8ff0a7d1b (patch) | |
tree | 9a8d937254d0db775120b505d2a3624512921a92 /.tools/render.sh | |
parent | 0cc65cc552af39dd1ec3c961b64daed367052601 (diff) |
First post
Diffstat (limited to '.tools/render.sh')
-rwxr-xr-x | .tools/render.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/.tools/render.sh b/.tools/render.sh new file mode 100755 index 0000000..273d574 --- /dev/null +++ b/.tools/render.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")/.." + +if [[ $# -ne 1 ]]; then + echo >&2 "Usage: $0 <path/to/post[.html]>" + echo >&2 "Renders the given post and saves the output to <post.rendered.html>." + exit 1 +fi + +postpath="$(echo "$1" | sed 's/\.html$//')" +inpath="${postpath}.html" +outpath="${postpath}.rendered.html" + +sed "/<!-- REPLACE CONTENT -->/ { r $inpath"$'\n'"; d; }" <'$template.html' >"$outpath" |