aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-07 13:56:19 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-07 13:56:19 +0200
commitbd67527a240f0e027d7375c7b03995b4ce1b4bef (patch)
tree6e5fabb7724d55f392289a833ef553e6fa8833fb
parent0ec9d66bc38e235008dfa181c17c101770dd8173 (diff)
added script and makefile for converting markdown to latex documents
-rw-r--r--.gitignore16
-rwxr-xr-xmd2latex13
-rw-r--r--opdracht-1/makefile2
-rw-r--r--opdracht-2/makefile2
-rw-r--r--opdracht-2/opdracht-2.m411
-rw-r--r--pdf.mk10
6 files changed, 45 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 3fc3088..5c49fdf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,19 @@ opdracht-*/*.md
opdracht-*/.tmp.sql
opdracht-*/opdracht.pdf
opdracht-*/opdracht-*.md
+
+# latex files
+**/*.aux
+**/*.bbl
+**/*.bcf
+**/*.blg
+**/*.fdb_latexmk
+**/*.fls
+**/*.html
+**/*.log
+**/*.out
+**/*.pdf
+**/*.run.xml
+**/*.synctex.gz
+**/*.tex
+**/*.toc
diff --git a/md2latex b/md2latex
new file mode 100755
index 0000000..4d2bdd2
--- /dev/null
+++ b/md2latex
@@ -0,0 +1,13 @@
+#!/bin/sh
+TARGET="$1"
+
+sed '/^# /d' "$1.md" | pandoc -f markdown -o "$1.html"
+cat ../preamble.tex > "$1.tex"
+
+echo '\begin{document}' >> "$1.tex"
+printf '\\textbf{Databases} %s \\hfill Loek Le Blansch (2180996)\n' "`echo "$1" | sed 's/-/ /g'`" >> "$1.tex"
+pandoc "$1.html" -t latex | sed 's/svg/pdf/g' >> "$1.tex"
+echo '\end{document}' >> "$1.tex"
+
+latexmk -quiet "$1.tex"
+latexmk -quiet -c "$1.tex"
diff --git a/opdracht-1/makefile b/opdracht-1/makefile
index b91dfe8..51cdd08 100644
--- a/opdracht-1/makefile
+++ b/opdracht-1/makefile
@@ -1,3 +1,5 @@
TARGET := opdracht-1
+MD2LATEX = ../md2latex
include ../common.mk
+include ../pdf.mk
diff --git a/opdracht-2/makefile b/opdracht-2/makefile
index 19a0072..37ed035 100644
--- a/opdracht-2/makefile
+++ b/opdracht-2/makefile
@@ -1,5 +1,6 @@
TARGET = opdracht-2
RESET_SQL += ../opdracht-1/.tmp.sql
+MD2LATEX = ../md2latex
all: $(TARGET).md
@@ -7,3 +8,4 @@ all: $(TARGET).md
make -C ../opdracht-1
include ../common.mk
+include ../pdf.mk
diff --git a/opdracht-2/opdracht-2.m4 b/opdracht-2/opdracht-2.m4
index bf43314..8ee1226 100644
--- a/opdracht-2/opdracht-2.m4
+++ b/opdracht-2/opdracht-2.m4
@@ -8,15 +8,8 @@ q_with_test(2)
## Opdracht 3
-<div align="center">
- <img src="img_erd.svg"/><br/>
- <i>ERD</i>
-</div>
-
-<div align="center">
- <img src="img_strokendiagram.svg"/><br/>
- <i>Strokendiagram</i>
-</div>
+![](img_erd.svg)
+![](img_strokendiagram.svg)
q_with_output(4)
q_with_output(5)
diff --git a/pdf.mk b/pdf.mk
new file mode 100644
index 0000000..83fc6d6
--- /dev/null
+++ b/pdf.mk
@@ -0,0 +1,10 @@
+INKSCAPE = inkscape
+
+FIGS_SVG = $(wildcard *.svg)
+FIGS_PDF = $(patsubst %.svg,%.pdf, $(FIGS_SVG))
+
+%.pdf: %.svg
+ $(INKSCAPE) -D $< -o $@
+
+$(TARGET).pdf: $(TARGET).md $(FIGS_PDF)
+ $(MD2LATEX) $(TARGET)