From 82b9f6c3ff97fccce19e0fa5fe34250bf3790f3f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 6 Oct 2025 22:09:12 +0200 Subject: Fixed navigation table using m4 --- build.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 93f0294..ca598e9 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,7 @@ #!/bin/sh +basedir="$(pwd)" + recursivebuild() { local destdir=$(echo "$1" | sed 's|^src|http|') mkdir -p "$destdir" @@ -13,17 +15,28 @@ recursivebuild() { done } +mdpreprocess() { + file="$1" + if [ "$(echo "$file" | sed 's/.*\.//')" = "m4" ]; then + printf 'm4_include(macros.m4)m4_dnl\n%s\n' "$(cat "$file")" | \ + m4 -P -I "$basedir/utils" + else + cat "$file" + fi +} + copyfile() { file=$1 dest=$2 ind=$dest/index.html extension=$(echo "$file" | sed 's/.*\.//') case "$extension" in - md) + md|m4) t="$(markdowntitle "$file")" sed "s/TITLE/$t/" < top.html > "$ind" - lowdown --html-no-skiphtml --html-no-escapehtml \ - "$file" >> "$ind" + mdpreprocess "$file" | \ + lowdown --html-no-skiphtml --html-no-escapehtml \ + >> "$ind" cat bottom.html >> "$ind" ;; html) -- cgit v1.3