about summary refs log tree commit diff stats
path: root/lib/chame0/gendoc.sh
blob: 4e7f557881be9881f4018a4b472ce143e567a764 (plain) (blame)
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
#!/bin/sh
mkdir -p .obj/doc
for f in chame/*.nim
do	if test "$f" = "chame/htmlparseriface.nim"
	then	nim doc -d:nimdocdummy --outdir:.obj/doc "$f"
	else	nim doc -p:test/chagashi/ --outdir:.obj/doc "$f"
	fi
        sed -i \
          -e '/<\!-- Google fonts -->/,+2d' \
          -e 's/theindex.html/index.html/g' \
          ".obj/doc/$(basename "$f" .nim).html"
done
makehtml() {
	printf '<!DOCTYPE html>
<head>
<meta name=viewport content="width=device-width, initial-scale=1">
<title>%s</title>
</head>
<body>
' "$2"
	cat "$1" | pandoc
	printf '</body>\n'
}
makehtml doc/manual.md "Chame manual" > .obj/doc/manual.html
makehtml doc/.index.md "Chame documentation" > .obj/doc/index.html