summaryrefslogtreecommitdiff
path: root/render.sh
diff options
context:
space:
mode:
authorSteph Enders <steph@senders.io>2023-06-26 19:49:02 -0400
committerSteph Enders <steph@senders.io>2023-06-26 19:49:02 -0400
commit522a9e55821d46e084be43c15e5819594bbee220 (patch)
tree590e6ebfebfaaf4da583652583738efa09a2fa20 /render.sh
parent8651853a781f114d9d354264d977105b0028e68a (diff)
Move entries to pages and rearrange files
Some minor spellchecking also involved here. But basically the intention is to do: pages/ More permanent pages entries/ These are just the articles themselves templates/ These are page snippets to include around The intention for splitting out entries is for if I host this also on gemini the entries are what I can do the processing against vs the page itself which contains the boilerplate template
Diffstat (limited to 'render.sh')
-rwxr-xr-xrender.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/render.sh b/render.sh
index 47cd89d..2ae2309 100755
--- a/render.sh
+++ b/render.sh
@@ -1,4 +1,13 @@
set -ex;
+
+function injectTemplate {
+ tmpl=$1
+ dest=$2
+ key=$(basename ${tmpl} .html)
+ sed -i "/[{]${key}[}]/r ${tmpl}" $dest
+ sed -i "s/[{]${key}[}]//g" $dest
+}
+
if [ $# -ne 2 ]; then
echo "Usage: ./render.sh <file> www/<path>/<to>/<prod>.html"
exit 1;
@@ -11,9 +20,11 @@ mkdir -p $(dirname $DEST)
cp $FILE $DEST
for tmpl in templates/*.html; do
- key=$(basename ${tmpl} .html)
- sed -i "/[{]${key}[}]/r ${tmpl}" $DEST
- sed -i "s/[{]${key}[}]//g" $DEST
+ injectTemplate $tmpl $DEST
+done
+for tmpl in entries/*.html; do
+ injectTemplate $tmpl $DEST
done
+
./tidy.sh $DEST