From caa30dd45d3ae76405a7f4ecc9641521c1fb8895 Mon Sep 17 00:00:00 2001 From: Johannes Herman Date: Mon, 16 Mar 2026 11:14:21 +0100 Subject: initial --- bin/make | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 bin/make (limited to 'bin/make') diff --git a/bin/make b/bin/make new file mode 100755 index 0000000..3d9c6fd --- /dev/null +++ b/bin/make @@ -0,0 +1,48 @@ +#!/bin/sh -eu + +. ./config + +title() { + [ -z "$1" ] && echo "$TITLE" && return + echo "${1##*/} - $TITLE" +} + +mkdir -p "$DIR_BUILD" + +echo ">> Building content" + +find "$DIR_CONTENT" -type f -name "*.$EXT_WRITINGS" | while read -r file; do + base=${file#"$DIR_CONTENT"/} + name=${base%."$EXT_WRITINGS"} + + outdir="$DIR_BUILD/$name" + if [ "$name" = "index" ]; then + output=$DIR_BUILD/index.html + name="" + else + output="$outdir/index.html" + mkdir -p "$outdir" + fi + + case "$name" in + *"${DIR_WRITINGS##*/}"*) name="$(sed -n '1s/^; //p' "$file")" ;; + esac + echo " $output" + markup < "$file" | makepage "$(title "$name")" > "$output" + +done + +echo ">> Generating writings indexes" + +mkdir -p "$DIR_WRITINGS_DST" +echo " $DIR_WRITINGS_DST/index.html" +makewritindex | makepage "$(title writings)" > "$DIR_WRITINGS_DST/index.html" + +for c in $(categories "$DIR_WRITINGS"/*."$EXT_WRITINGS"); do + mkdir -p "$DIR_WRITINGS_DST/$c" + echo " $DIR_WRITINGS_DST/$c/index.html" + makewritindex "$c" | makepage "$(title "#$c")" > "$DIR_WRITINGS_DST/$c/index.html" +done + +echo ">> Copying static content" +cp -rv "$DIR_STATIC"/* "$DIR_BUILD" | sed -E "s/.*-> '(.*)'/ \1/" -- cgit v1.2.3