From fee7a2800565a21a39e11cd1beec358111a1a01f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 20 Feb 2022 18:50:47 +0100 Subject: Initial commit --- build.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 build.sh (limited to 'build.sh') diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1308a99 --- /dev/null +++ b/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +recursivebuild() { + local destdir=$(echo $1 | sed 's|^src|http|') + mkdir -p "$destdir" + for file in $(ls $1); do + if [ -d "$1/$file" ]; then + mkdir -p "$destdir/$file" + recursivebuild "$1/$file" + else + extension=$(echo "$file" | sed 's/.*\.//') + if [ "$extension" = "md" ]; then + sed "s/TITLE/$(grep '^\# ' < "$1/$file" \ + | sed 's/^\# //')/" < top.html \ + > "$destdir/index.html" + lowdown "$1/$file" >> "$destdir/index.html" + cat bottom.html >> "$destdir/index.html" + elif [ "$extension" = "html" ]; then + cat top.html "$1/$file" bottom.html \ + | sed "s/TITLE/$(grep '$//')/" \ + > "$destdir/index.html" + else + cp "$1/$file" "$destdir/$file" + fi + fi + done +} + +recursivebuild src -- cgit v1.3