-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgenerate_page.sh
executable file
·57 lines (47 loc) · 1.02 KB
/
generate_page.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
#!/bin/bash
##
## generate_page.sh
##
## Made by gaspar_d
## Login <[email protected]>
##
## Started on Tue 23 Feb 20:17:04 2016 gaspar_d
## Last update Wed 11 May 17:54:27 2016 gaspar_d
##
print_usage() {
cat <<EOF
OVERVIEW: generate a standalone HTML page that you can share with your colleagues
USAGE: $0 file1.csv file2.csv ...
EOF
}
main() {
gCSVs=""
while [[ "$#" -gt "0" ]]; do
file=$1
content=`cat $file`
gCSVs="${gCSVs}\`${content}\`,"
shift;
done
gCSVs="[${gCSVs%?}]"
output=$1
html=`cat index.html | grep -v stylesheet | grep -v script | grep -v '</body>'`
echo $html
for js in js/{d3.min.js,jquery-2.1.4.js,nv.d3.min.js,dashboard.js,graph.js}; do
echo "<script type='text/javascript'>"
cat ${js}
echo "</script>"
done
echo "<script type='text/javascript'>gCSVs=${gCSVs};</script>"
for css in css/*.css; do
echo "<style>"
cat ${css}
echo "</style>"
done
echo "</body>"
echo "</html>"
}
if [ $# -eq 0 ]; then
print_usage $0
exit 1
fi
main $@