aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-04 20:48:36 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-04 20:48:36 +0200
commit7514bd355d109c8cab953d152e7f06a03687ed95 (patch)
tree57e3f45eee99ff24f7619f1dfdaaf65998a0be19
parent25de6db1afc10c984d02a97b1c1d916abfcd82bf (diff)
move shared templating code to common.m4
-rw-r--r--common.m433
-rw-r--r--opdracht-1/opdracht-1.m434
-rw-r--r--opdracht-2/opdracht-2.m436
3 files changed, 36 insertions, 67 deletions
diff --git a/common.m4 b/common.m4
new file mode 100644
index 0000000..8d60f41
--- /dev/null
+++ b/common.m4
@@ -0,0 +1,33 @@
+define({{include_sql}}, {{
+```sql
+include({{$1.sql}})
+```
+}})
+
+define({{q_norm}}, {{
+## Opdracht $1
+
+Query:
+include_sql({{q$1}})
+}})
+
+define({{q_with_output}}, {{
+## Opdracht $1
+
+Query:
+include_sql({{t$1}})
+
+Output:
+include({{t$1.md}})
+}})
+
+define({{q_with_test}}, {{
+q_norm($1)
+
+Test query:
+include_sql({{t$1}})
+
+Output:
+include({{t$1.md}})
+}})
+
diff --git a/opdracht-1/opdracht-1.m4 b/opdracht-1/opdracht-1.m4
index 59b85eb..fbb1a89 100644
--- a/opdracht-1/opdracht-1.m4
+++ b/opdracht-1/opdracht-1.m4
@@ -1,37 +1,5 @@
changequote(`{{', `}}')
-
-define({{include_sql}}, {{
-```sql
-include({{$1.sql}})
-```
-}})
-
-define({{q_norm}}, {{
-## Opdracht $1
-
-Query:
-include_sql({{q$1}})
-}})
-
-define({{q_with_output}}, {{
-## Opdracht $1
-
-Query:
-include_sql({{t$1}})
-
-Output:
-include({{t$1.md}})
-}})
-
-define({{q_with_test}}, {{
-q_norm($1)
-
-Test query:
-include_sql({{t$1}})
-
-Output:
-include({{t$1.md}})
-}})
+include({{../common.m4}})
# Practicum 1
diff --git a/opdracht-2/opdracht-2.m4 b/opdracht-2/opdracht-2.m4
index 627cb36..e733be3 100644
--- a/opdracht-2/opdracht-2.m4
+++ b/opdracht-2/opdracht-2.m4
@@ -1,39 +1,7 @@
changequote(`{{', `}}')
+include({{../common.m4}})
-define({{include_sql}}, {{
-```sql
-include({{$1.sql}})
-```
-}})
-
-define({{q_norm}}, {{
-## Opdracht $1
-
-Query:
-include_sql({{q$1}})
-}})
-
-define({{q_with_output}}, {{
-## Opdracht $1
-
-Query:
-include_sql({{t$1}})
-
-Output:
-include({{t$1.md}})
-}})
-
-define({{q_with_test}}, {{
-q_norm($1)
-
-Test query:
-include_sql({{t$1}})
-
-Output:
-include({{t$1.md}})
-}})
-
-# Practicum 1
+# Practicum 2
q_with_test(1)
q_with_test(2)