-
Notifications
You must be signed in to change notification settings - Fork 183
/
setup-note.sh
executable file
·61 lines (52 loc) · 1.35 KB
/
setup-note.sh
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
#!/usr/bin/env bash
# Usage: $0 github.com <user> <repo> [drafts...]
set -e
host="$1"
user="$2"
repo="$3"
shift 3
# Determine if the draft is a kramdown draft with a venue section.
hasvenue() {
head -1 "$1" | grep -q "^---" && \
sed -e '2,/^---/p;d' "$1" | grep -q '^venue:'
}
if [[ -z "$WG" ]]; then
# Guess the working group name from the drafts
first=true
for d in "$@"; do
# If a kramdown has a venue section, skip it.
if hasvenue "$d"; then
continue
fi
w="${d#draft-}"
w="${w#*-}"
w="${w%%-*}"
if $first; then
wg="$w"
first=false
elif [[ "$wg" != "$w" ]]; then
echo "Found conflicting working group names in drafts" 1>&2
echo " $wg != $w" 1>&2
wg=""
break
fi
done
else
wg="${WG}"
fi
if $first; then
exit 0
fi
. $(dirname "$0")/wg-meta.sh
if ! wgmeta "$wg"; then
wg=""
fi
echo '<note title="Discussion Venues" removeInRFC="true">'
if [[ -n "$wg" ]]; then
echo "<t>Discussion of this document takes place on the
${wg_name} ${wg_type} mailing list (${wg_mail}),
which is archived at <eref target=\"${wg_arch}\"/>.</t>"
fi
echo "<t>Source for this draft and an issue tracker can be found at
<eref target=\"https://${host}/${user}/${repo}\"/>.</t>"
echo '</note>'