-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure
executable file
·46 lines (42 loc) · 960 Bytes
/
configure
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
#!/bin/sh
set -euo pipefail
get_name() {
sed -En '/^---$/,/^---$/{
/^slug:/{
s/\//./g
s/^slug: Web\.(API|JavaScript\.Reference\.Global_Objects)\.//p
q
}
}' "$1"
}
get_files() (
m=$1
shift
grep -rLxE \
-e 'page-type: (guide|landing-page|web-api-overview)' \
-e ' - (deprecated|experimental|non-standard)' \
"$@" |
while read f; do
if [ "${f##*/}" != index.md ]; then continue; fi
name=$(get_name "$f")
if ! [ "$name" ]; then
echo >&2 failed to get name for "$f"
exit 1
fi
case $name in *\ *)
echo >&2 invalid name for "$f"
exit 1
esac
o='$(mansectdir)'/$name.'$(mansect)'
printf ' %s' "$o"
printf '%s: %s\n\t$(MD2MAN) %s > $@ || { $(RM) $@; false; }\n' \
"$o" "$f" "$f" >> "$m"
done
)
base=content/files/en-us/web
dirs="$base/api $base/javascript/reference/global_objects"
for dir in $dirs; do
(cd "$dir" && git-restore-mtime)
done
>files.mk
printf 'files=%s\n' "$(get_files files.mk $dirs)" >> files.mk