summaryrefslogtreecommitdiff
path: root/http/bin/mkws
blob: fa4cd996ef378ce3fc4df401c85c5f52cfc4f5fc (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
41
#!/bin/sh -e
export PATH="$(dirname $(realpath $0)):$PATH"

usage() {
	>&2 printf "usage: %s url [path]\\n" "$(basename "$0")"
	exit 1
}

test $# -lt 1 && usage

export SRC="$(realpath src)"
export SHARE="$(realpath share)"
export OUT="$(realpath public)"
mkdir -p ${OUT}

if ! test -f "${SRC}"/index.upphtml
then
	>&2 printf "no index.upphtml file found\\n"
	exit 1
fi

for t in "${SRC}"/*.upphtml
do
	echo "Making $(basename "${t%.upphtml}".html)"
	pp "${SHARE}"/l.upphtml "${t}" "$1" > \
		"${OUT}/$(basename "${t%.upphtml}".html)"
done

for t in "${SRC}"/**/*.uppcss
do
  t_out="${t%.uppcss}".css
  t_out="${t_out#${SRC}/}"
  echo "Making ${t_out}"
  t_out="${OUT}/${t_out}"
  mkdir -p "$(dirname "${t_out}")"
  pp "${t}" "$1" > \
		"${t_out}"
done

echo "Making sitemap.xml"
pp "${SHARE}"/sitemap.uppxml "$1" > "${OUT}"/sitemap.xml