From bd67527a240f0e027d7375c7b03995b4ce1b4bef Mon Sep 17 00:00:00 2001 From: lonkaars Date: Fri, 7 Oct 2022 13:56:19 +0200 Subject: added script and makefile for converting markdown to latex documents --- .gitignore | 16 ++++++++++++++++ md2latex | 13 +++++++++++++ opdracht-1/makefile | 2 ++ opdracht-2/makefile | 2 ++ opdracht-2/opdracht-2.m4 | 11 ++--------- pdf.mk | 10 ++++++++++ 6 files changed, 45 insertions(+), 9 deletions(-) create mode 100755 md2latex create mode 100644 pdf.mk 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 -
-
- ERD -
- -
-
- Strokendiagram -
+![](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) -- cgit v1.2.3