generated from TREX-CoE/school-slovakia-2022
-
Notifications
You must be signed in to change notification settings - Fork 1
/
create.sh
executable file
·55 lines (45 loc) · 1.16 KB
/
create.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
#!/bin/bash
readonly HTMLIZE=./docs/htmlize.el
if [[ -z $1 ]] ; then
ORG_FILES="*.org"
else
ORG_FILES=$1
fi
echo $ORG_FILES
# Download the htmlize Emacs plugin if not present
url="https://github.com/hniksic/emacs-htmlize"
repo="emacs-htmlize"
if [[ ! -f "${HTMLIZE}" ]]
then
git clone ${url} \
&& cp ${repo}/htmlize.el ${HTMLIZE} \
&& rm -rf ${repo}
fi
# Assert htmlize is installed
[[ -f ${HTMLIZE} ]] \
|| exit 1
# Convert org to HTML
if [[ -f ./docs/htmlize.el ]]
then
for org in ${ORG_FILES}
do
echo "HTMLIZE: $org"
emacs --batch --load ./docs/htmlize.el --load ./docs/config.el $org -f org-html-export-to-html &
done
wait
else
for org in ${ORG_FILES}
do
echo "CONVERT: $org"
emacs --batch --load ./docs/config.el $org -f org-html-export-to-html &
done
wait
fi
mv *.html docs/
cd docs
for i in *.html ; do
sed -i "s/ HOME / NEXT /" $i
sed -i "s/ UP / PREV /" $i
sed -i '/^<h2>Table of Contents<\/h2>/i<a href="index.html"><h2>HOME<\/h2></a>' $i
sed -i '/^<head>/a<script defer data-domain="trex-coe.github.io\/school-ncc-2023" src="https:\/\/plausible.io\/js\/script.js"></script>' $i
done