diff options
author | hitlerrip <git@hitler.rip> | 2025-07-29 16:27:37 +0200 |
---|---|---|
committer | hitlerrip <git@hitler.rip> | 2025-07-29 16:27:37 +0200 |
commit | 27e8698c8d32f25292cac5174314f69e34192b38 (patch) | |
tree | 31bbfcb9ccfc185b562f61953dd7ac464ad270c6 | |
parent | c7b706f6884ab1bce0625275c640296f6558f7be (diff) | |
download | website-27e8698c8d32f25292cac5174314f69e34192b38.tar.gz website-27e8698c8d32f25292cac5174314f69e34192b38.tar.bz2 website-27e8698c8d32f25292cac5174314f69e34192b38.zip |
convert function
added convert() to make code more sensible
-rwxr-xr-x | build.sh | 27 |
1 files changed, 11 insertions, 16 deletions
@@ -1,10 +1,17 @@ -#!/bin/sh +#!/bin/bash # hitler.rip # script to build my website using pandoc # © 2025 hitler.rip <git@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!" |