From 27e8698c8d32f25292cac5174314f69e34192b38 Mon Sep 17 00:00:00 2001 From: hitlerrip Date: Tue, 29 Jul 2025 16:27:37 +0200 Subject: convert function added convert() to make code more sensible --- build.sh | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 4e18dbe..634f24f 100755 --- a/build.sh +++ b/build.sh @@ -1,10 +1,17 @@ -#!/bin/sh +#!/bin/bash # hitler.rip # script to build my website using pandoc # © 2025 hitler.rip # licensed under AGPLv3-or-later; see licenses/code.md for more information +filterfile=($( realfile ./con/links.lua )) +convert () { + pandoc "$1" -o "$2" \ + -f gfm -t html5 \ + --lua-filter="$filterfile" +} + echo "[build] starting to build webpage..." rm -rf ./tmp/ @@ -33,16 +40,11 @@ for i in *.md; do echo "[build] converting: $i" filename=$( echo "$i" | rev | cut -c4- | rev ) - - pandoc "$i" -o ../tmp/"$filename".html \ - -f gfm -t html5 \ - --lua-filter=../con/links.lua + convert "$i" "../tmp/$filename.html" if [ "$filename" == "index" ]; then - pandoc ../con/contact.md -o ../tmp/con-contact-tmp-file.html \ - -f gfm -t html5 \ - --lua-filter=../con/links.lua + convert "../con/contact.md" "../tmp/con-contact-tmp-file.html" cat ../con/header.html \ ../tmp/"$filename".html \ @@ -77,10 +79,7 @@ for i in *.md; do echo "[build] converting: $i" filename=$( echo "$i" | rev | cut -c4- | rev ) - - pandoc "$i" -o ../../tmp/articles/"$filename".html \ - -f gfm -t html5 \ - --lua-filter=../../con/links.lua + convert "$i" "../../tmp/articles/$filename.html" if [ "$filename" == "index" ]; then echo "[build] skipping index file for later..." @@ -180,16 +179,12 @@ cat ./con/rss-header.xml \ > ./web/articles/feed.xml echo "[build] copying static files..." - cp ./con/style.css ./web/style.css cp ./con/icon.png ./web/icon.png - cp ./licenses/* ./web/licenses/ - cp -r ./dir/* ./web/ echo "[build] removing temporary build files..." - rm -rf ./tmp echo "[build] done!" -- cgit v1.2.3