blob: e6b31414cf21270f68d2db560a3bb112169c149f (
plain)
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
|
num=0
for file in src/{.[!.]*,*}.txt; do
# TODO: change this to work with globs & args & stuff
echo -n "Compiling $file to HTML5"
pandoc -f markdown \
-t html5 \
--template=.template.html \
--smart \
--mathml \
"$file" \
-o "${file%.txt}.html"
echo -n " & RIVER ..."
pandoc -f markdown \
-t lua/river.lua \
"$file" \
-o "${file%.txt}.river"
echo " Done."
((num += 1))
done
echo
echo "Moving files to build directory ..."
mv src/{.[!.]*,*}.html ./
echo "Moving RIVERs to river/ ..."
mv src/{.[!.]*,*}.river river/
echo "Concatenating and counting rivers ..."
cat river/*.river | \
sed -e "s/^\s\+//" -e "s/\s\+$//" -e 's/--\+/\n/g' | \
sort | uniq -c | sort >river/COUNTS.txt
echo "Finished compiling $num files."
###############################################
echo
echo "Updating js/lozenge.js with file list ..."
lozengeList=( $(ls *.html) )
list=$(sed -e 's/\S\+\.html/"&",/g' -e 's/,$//' -e 's/^.*$/var files=[&]/' <<< "${lozengeList[@]}")
sed -i "s/var files=.*/$list/" js/lozenge.js
echo "Finished updating: ${#lozengeList[@]} files."
|