diff options
| author | Johannes Herman <johannes.herman@gmail.com> | 2026-03-16 11:14:21 +0100 |
|---|---|---|
| committer | Johannes Herman <johannes.herman@gmail.com> | 2026-03-16 11:14:21 +0100 |
| commit | caa30dd45d3ae76405a7f4ecc9641521c1fb8895 (patch) | |
| tree | 5641956935e8ef6cb487d47456b884443e5118e8 /bin/make | |
initial
Diffstat (limited to 'bin/make')
| -rwxr-xr-x | bin/make | 48 |
1 files changed, 48 insertions, 0 deletions
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/" |
