blob: 2c8c36a4753165576a27d4cd4963700e59d2068d (
about) (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/bin/sh
set -eu
TLD="$(cat aux/tld.txt)"
. aux/lib.sh
PROJECT_UC=
while getopts 'n:N:m:o:l:' flag; do
case "$flag" in
n)
PROJECT="$OPTARG"
;;
N)
PROJECT_UC="$OPTARG"
;;
m)
MAILING_LIST="$OPTARG"
;;
o)
OUTDIR="$OPTARG"
;;
l)
LANGS="$OPTARG"
;;
*)
exit 2
;;
esac
done
shift $((OPTIND - 1))
assert_arg() {
if [ -z "$1" ]; then
echo "Missing $2" >&2
exit 2
fi
}
assert_arg "${PROJECT:-}" '-n PROJECT'
assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
assert_arg "${OUTDIR:-}" '-o OUTDIR'
assert_arg "${LANGS:-}" '-l LANGS'
PROJECT_UC="${PROJECT_UC:-$PROJECT}"
alternates_for() {
ALTERNATES="$(mkstemp)"
lang="$1"
OUTNAME="$2"
for l in $LANGS; do
if [ "$l" = "$lang" ]; then
continue
fi
cat <<EOF >> "$ALTERNATES"
<link rel="alternate" href="https://$TLD/$PROJECT/$l/$OUTNAME" hreflang="$l" />
EOF
done
echo "$ALTERNATES"
}
mkdir -p "$OUTDIR"
sh aux/workflow/TODOs.sh \
-N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR"
for lang in $LANGS; do
mkdir -p "$OUTDIR/$lang/"
sh aux/workflow/commonmark.sh \
-N "$PROJECT" -l "$lang" -t README \
-H "$(alternates_for "$lang" '')" \
< "README.$lang.md" > "$OUTDIR/$lang/index.html"
sh aux/workflow/commonmark.sh \
-N "$PROJECT" -l "$lang" -t CHANGELOG \
-H "$(alternates_for "$lang" 'CHANGELOG.html')" \
< "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html"
ln -fs ../favicon.svg "$OUTDIR/$lang"
done
ln -fs en/index.html "$OUTDIR/index.html"
cp aux/workflow/favicon.svg "$OUTDIR"
sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"
|