-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch
executable file
·45 lines (37 loc) · 1.04 KB
/
fetch
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
#!/bin/bash
set -e
cd "$(dirname "$0")"
id="$1"
task_dir="$(printf "tasks/%03d" "${id}")"
server="https://top-prover.top"
mkdir -p "${task_dir}"
curl -s -f -b .cookie -o "${task_dir}/main.html" "${server}/problem/${id}"
sed -n 's:^<h2>\(.*\)</h2>$:\1:p' "${task_dir}/main.html" > "${task_dir}/description"
sed -i -e 's:<:<:g' -e 's:>:>:g' "${task_dir}/description"
cat "${task_dir}/description"
curl -s -f -b .cookie -o "${task_dir}/Problem.v" "${server}/problem_content/${id}"
curl -s -f -b .cookie -o "${task_dir}/Example.v" "${server}/example_content/${id}"
curl -s -f -b .cookie -o "${task_dir}/Checker.v" "${server}/checker_content/${id}"
nkf -Lu -d --in-place "${task_dir}"/{Problem,Example,Checker}.v
if [ ! -e "${task_dir}/Solution.v" ]; then
sed 's/^Qed\./Admitted./' "${task_dir}/Example.v" > "${task_dir}/Solution.v"
fi
cat > "${task_dir}/_CoqProject" <<EOF
-R . Top
Problem.v
Solution.v
Checker.v
EOF
cat > "${task_dir}/.gitignore" <<EOF
/*.aux
/*.d
/*.glob
/*.vo
/*.vok
/*.vos
/.lia.cache
/Makefile
/Makefile.conf
/log
/main.html
EOF