This repository has been archived by the owner on Oct 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pub.sh
53 lines (42 loc) · 1.41 KB
/
pub.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
#!/bin/bash
set -x
mkdir tmp/src
mkdir tmp/ref
# clear out the target where we'll assemble all the files
cd tmp
rm *
cd ..
# grab all the .md files somewhere off src
cd src
find . | grep '\.md' | sed 's/\.\///g' > ../sources.txt
cd ..
while IFS= read -r file
do
cat src/$file | python insertions-and-slideshows.py $file
done < "sources.txt"
rm sources.txt
cd tmp
# mv ref/* . removed cuz the python app saves to tmp/ PERIOD
ls -1 *.md | cut -f 1 -d '.' > sources.txt
while IFS= read -r file
do
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" type="text/css" media="all" href="ds-style.css" /><div id="main">' > $file.html
# markdown $file.md >> $file.html
markdown $file.md | sed -r 's/<br><br>/XYXYXYXY/g' | sed -r 's/<br>/ /g' | sed -r 's/XYXYXYXY/<br>/g' >> $file.html
# md2html -p -f $file.md -o $file.html
# https://www.npmjs.com/package/markdown-to-html
# this is installed with -g, so md2html works, but the next-page insertions might$
echo '</div>' >> $file.html
# because md2html escapes critical syntax, i unescape it.
sed -i -e 's/</</g' $file.html
sed -i -e 's/>/>/g' $file.html
sed -i -e "s/'/'/g" $file.html
sudo cp $file.html /var/www/html/
# cp $file.html ../html
done < "sources.txt"
# there are two different sources.txt files,
# one's in tmp/sources.txt, and they differ in content!
rm sources.txt
cd ../src/root-files
sudo cp -r * /var/www/html/
cd ..