codex/gen.sh

32 lines
858 B
Bash
Executable File

#!/bin/sh
# Strip the CSS file of whitespace to reduce file size
echo "Generating CSS"
makros resources/style-formatted.css | tr -d " \t\n\r" > resources/style.css
# Generate HTML pages from Writan sources
echo "Generating pages"
for file in site-src/*; do
bn=$(basename $file .wtn)
echo " $file -> site/$bn.html"
# if the file has macros, expand them
if grep "#makro" $file >/dev/null; then
tmp=$(mktemp)
makros $file > $tmp
./format $tmp site/$bn.html
rm $tmp
else
./format $file site/$bn.html
fi
done
# Generate the site index
indexfile=site/site-index.html
cat resources/header.html > $indexfile
echo "Generating full site index"
for file in site/*; do
bn=$(basename $file .html)
echo "<p><a href=\"$bn.html\">$bn</a>" >> $indexfile
done
cat resources/footer.html >> $indexfile