forked from Sciumo/GeographicLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-compress.sh
39 lines (39 loc) · 1.4 KB
/
js-compress.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
#! /bin/sh
# Concatenate and strip JavaScript files
cat <<EOF
/*
* Geodesic routines from GeographicLib translated to JavaScript. For
* more information, see
* http://geographiclib.sf.net/html/other.html#javascript
*
* The algorithms are derived in
*
* Charles F. F. Karney,
* Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
* https://dx.doi.org/10.1007/s00190-012-0578-z
* Addenda: http://geographiclib.sf.net/geod-addenda.html
*
* Copyright (c) Charles Karney (2011-2014) <[email protected]> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sf.net/
*
* Inventory of files;
EOF
for f; do
echo " * " `basename $f`
done
echo " */"
for f; do
echo "// `basename $f`"
cat $f | sed -e '1,/\*\//d' -e 's%//.*%%' | tr -s ' ' ' ' |
sed -e 's/^ //' -e 's/ $//' | grep -v '^$' |
sed -e 's/\([^",:A-Za-z0-9_]\) /\1/g' |
sed -e 's/ \([^\[":A-Za-z0-9_]\)/\1/g' |
sed -e 's/^\([^"]*\) :/\1:/' -e 's/^\([^"]*\) :/\1:/' |
sed -e 's/^\([^"]*\) :/\1:/' -e 's/^\([^"]*\) :/\1:/' |
sed -e 's/^\([^"]*\) :/\1:/' -e 's/^\([^"]*\) :/\1:/' |
sed -e 's/\([:,]\) \([^"]*\)$/\1\2/' -e 's/\([:,]\) \([^"]*\)$/\1\2/' |
sed -e 's/\([:,]\) \([^"]*\)$/\1\2/' -e 's/\([:,]\) \([^"]*\)$/\1\2/' |
sed -e 's/\([:,]\) \([^"]*\)$/\1\2/' -e 's/\([:,]\) \([^"]*\)$/\1\2/' |
sed -e 's/, "/,"/g' -e 's/" : "/":"/g' -e 's/\([^ ]\): /\1:/g'
done