-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·49 lines (37 loc) · 1.4 KB
/
build.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
#!/bin/bash
# create tmp dir
mkdir .tmp
# copy all md files
cp _index.md .tmp/0-MCreator_Minecraft_Mod_erstellen.md
# copy and reaname all the index.md (index.md is required for website generation)
for f in */*.md; do
# ls $f
cp $f .tmp/$(ls $f | sed "s/\//-/g")
done
# copy all the pngs
cp jugendhackt-schrift.png .tmp/
cp */*.png .tmp/
# step into the temporal depths
cd .tmp
# replace special containers
for f in *.md; do
# echo "::::::file $f\n"
## {{%notice note überschrift hier%}} -> ::: note\n###überschrift
## note -> note
sed -i.bak -E "s/{{%[[:space:]]*notice[[:space:]]+note[[:space:]]+(.*)%}}/::: note \n**\1**\n/g" $f
## task -> note
sed -i.bak -E "s/{{%[[:space:]]*notice[[:space:]]+task[[:space:]]+(.*)%}}/::: note \n**\1**\n/g" $f
## warning -> warning
sed -i.bak -E "s/{{%[[:space:]]*notice[[:space:]]+warning[[:space:]]+(.*)%}}/::: warning \n**\1**\n/g" $f
## success -> tip
sed -i.bak -E "s/{{%[[:space:]]*notice[[:space:]]+success[[:space:]]+(.*)%}}/::: tip \n**\1**\n/g" $f
## {{% /notice %}} => :::
sed -i.bak -E "s/{{%[[:space:]]*\/[[:space:]]*notice[[:space:]]*%}}/:::/g" $f
done
# convert with pandoc
pandoc *.md -o ../output.docx
pandoc *.md -o "../output.pdf" --from markdown --template "../eisvogel.latex" --filter pandoc-latex-environment --listings
# mission accomplished, leave .tmp/
cd ..
# get rid of .tmp/
rm -r .tmp