forked from Aposymbiont/split-keyboards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-index
executable file
·30 lines (25 loc) · 914 Bytes
/
build-index
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
#!/bin/bash -e
if [[ $(cat *.csv | tr -dc ',\n' | uniq) != ',,,,,,,,' ]]; then
echo >&2 "Incorrect number of columns in one of the CSV files"
exit 1
fi
(
cat index-head.hc
(
grep -h -v -e '^#' -e '^Name,' ergo.csv dish.csv ortho.csv traditional.csv other.csv | shuf
grep -h -v -e '^#' -e '^Name,' placeholders.csv
) | \
while IFS=, read -r name layout features availability minKeys maxKeys website image note; do
if [[ ! -f img/$image ]]; then
echo >&2 "Image img/$image not found for $name"
exit 1
fi
cat <<-EOF
<div class="mix $features" data-layout="$layout" data-keys="$maxKeys" data-availability="$availability">
<h3>$name</h3>
<a href="$website"><img src="img/$image"/></a>
</div>
EOF
done
cat index-tail.hc
) > index.html