site-neo/src/_tape/render.sh

32 lines
737 B
Bash
Raw Normal View History

2022-09-24 18:07:46 -04:00
#!/bin/bash
2022-10-04 17:42:16 -04:00
# render.sh: part of the tape-and-string framework.
2023-02-01 12:59:45 -05:00
# v2.1
declare -A prog
prog[m4]=`readlink -f main.html.m4`
prog[lib]=`readlink -f lib.m4`
prog[title]=`readlink -f titlelookup`
function tape {
case $1 in
*.txti) redcloth $1 ;;
*.org) org-ruby --translate html $1 ;;
*.md) comrak --gfm $1 ;;
*.html) cat $1 ;;
*) pandoc --cols 168 -t html $i || echo "Unable to render $i, unknown format" ;;
esac
}
2023-01-21 18:23:04 -05:00
cd ..
2023-02-01 11:59:44 -05:00
files=(`find -not -path './_*'`)
2023-01-21 18:40:35 -05:00
for i in ${files[@]}; do
2023-02-01 12:59:45 -05:00
echo $i
2023-01-21 18:40:35 -05:00
if test -d $i; then
2023-02-01 11:04:04 -05:00
if test -d ../$i; then
2023-02-01 12:59:45 -05:00
mkdir -vp ../$i
2023-02-01 11:04:04 -05:00
else continue
fi
2023-01-21 18:40:35 -05:00
elif test -f $i; then
2023-02-01 12:59:45 -05:00
tape $i | m4 -DTITLE=`${prog[title]}` -DLIB=${prog[lib]} ${prog[m4]} > ../$i
2023-01-21 18:40:35 -05:00
else
echo "Skipping $i, unknown file type"
fi
2022-09-24 18:07:46 -04:00
done