summaryrefslogtreecommitdiff
path: root/contrib/man2html
blob: 5dea8761bdad3635090651227e467ea9d09b582f (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
#!/bin/sh

if [ $# -ne 1 ]; then
	echo usage: contrib/man2html outdir
	exit
fi

if [ ! -d $1 ]; then
	echo $1 doesn\'t exist
	exit
fi

cat <<EOF > $1/index.html
<!DOCTYPE html>
<title>camellia manpages</title>
<ul>
EOF

for path in man/*; do
	echo $path
	file=${path#man/}
	name=${file%.*}
	sec=${file#*.}
	printf "<li><a href=\"$file.html\">$name($sec)</a> – " >> $1/index.html
	sed -ne 's/^.Nd *//p' $path >> $1/index.html
	echo "</li>" >> $1/index.html
	mandoc -Tlint $path 2>&1 | grep -vE "mandoc.db|manual not found|operating system"
	mandoc -Thtml -Ostyle=mandoc.css,man=%N.%S.html $path > $1/$file.html
done