aboutsummaryrefslogtreecommitdiff
path: root/website/genhtml.sh
blob: f75f6b413bfaa81abda066d41f0a15bf57173317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh -e

rm -rf public
mkdir -p public

rm -rf smu
git clone --depth=1 https://github.com/karlb/smu
make -C smu

# docs
mkdir -p public/docs
rm -f docs.md
for i in docs/*.md; do
	echo "generating html for $i..."
	i=${i#*/}
	{
		sed "s/@TITLE@/docs/g" header
		./smu/smu docs/$i
		cat footer
	} > public/docs/${i%.md}.html
	echo "- [$(head -n1 docs/$i)](./docs/${i%.md}.html)" >> docs.md
done

# top files
for i in *.md; do
	echo "generating html for $i..."
	{
		title=${i%.md}
		case ${i%.md} in index) title=home; esac
		sed "s/@TITLE@/$title/g" header
		./smu/smu $i
		cat footer
	} > public/${i%.md}.html
done

if [ -d assets ]; then
	cp -ra assets public/
fi

exit 0