-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakepdf.sh
executable file
·52 lines (48 loc) · 1.3 KB
/
makepdf.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
#!/bin/bash
function makeHeader () {
echo '\documentclass{beamer}';
echo "\\title{$titl}"
echo "\\author{$auth}"
echo "\\date{$date}"
echo '\begin{document}\AtBeginSection[] {\begin{frame}[plain]\frametitle{Overview}\tableofcontents[currentsection]\end{frame}}'
}
function makeFooter () {
echo '\end{document}'
}
function makeTitle () {
echo ' \begin{frame}\maketitle{}\end{frame}\begin{frame}\tableofcontents{}\end{frame}'
}
function slide () {
fisc=$(echo "$cnti" | grep -P '#+ (.*)')
ftip=$(echo "$fisc" | tail -n 1 | sed -r 's/#+ +//g')
if [ ! -z "$ftip" ]
then
ftit="$ftip"
fi
echo "$fisc" | pandoc -f markdown -t latex -S --normalize
frmi=$(echo "$cnti" | pandoc -f markdown -t latex -S --normalize)
echo "\\begin{frame}[allowframebreak]{$ftit}"
echo "$frmi" | grep -v -P '\\section\{.*|\\label{.*'
echo '\end{frame}'
}
cnt=$(cat)
titl=$(echo "$cnt" | bash scrape.sh -t)
desc=$(echo "$cnt" | bash scrape.sh -D)
auth=$(echo "$cnt" | bash scrape.sh -a)
date=$(echo "$cnt" | bash scrape.sh -d)
slid=0;
makeHeader
makeTitle
for slb in `echo "$cnt" | grep -n -e '----' | cut -f1 -d:`
do
slb=$(($slb+1))
cnti=$(echo "$cnt" | tail -n +$slb)
sle=$(echo "$cnti" | grep -n -m 1 -e '----' | cut -f1 -d:)
if [ -n "$sle" ]
then
sle=$(($sle-1))
cnti=$(echo "$cnti" | head -n $sle)
fi
slide
done
makeFooter