-
Notifications
You must be signed in to change notification settings - Fork 6
/
crisis.sh
46 lines (39 loc) · 1.02 KB
/
crisis.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
#!/bin/bash
set -eu
set -o pipefail
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
SCRIPT_DIR=$(dirname ${SCRIPT_PATH})
SLIDES=${1:-20}
cd $SCRIPT_DIR
cat > /tmp/$$ <<EOF
[
{
"filename": "crisis.md",
"attr":
{
"data-autoslide": 5000,
"data-background": "#fffff",
"data-background-image": "resources/images/ith-background.png"
}
},
EOF
i=1
for file in $(find resources/images/crisis -type f)
do
if [[ ! -e slides/${i}.html ]]; then
echo "" > slides/${i}.html
fi
echo " {" >> /tmp/$$
echo " \"filename\": \"${i}.html\"," >> /tmp/$$
echo " \"attr\": {" >> /tmp/$$
echo " \"data-background-image\": \"${file}\"," >> /tmp/$$
echo " \"data-background-size\": \"contain\"" >> /tmp/$$
echo " }" >> /tmp/$$
echo -n " }" >> /tmp/$$
i=$((i + 1))
if [[ $i -le ${SLIDES} ]]; then
echo "," >> /tmp/$$
fi
done
echo "]" >> /tmp/$$
mv /tmp/$$ slides/list.json