summary refs log tree commit diff stats
path: root/java/template.typ
diff options
context:
space:
mode:
Diffstat (limited to 'java/template.typ')
-rw-r--r--java/template.typ24
1 files changed, 15 insertions, 9 deletions
diff --git a/java/template.typ b/java/template.typ
index ecaa5da..192ce1c 100644
--- a/java/template.typ
+++ b/java/template.typ
@@ -31,7 +31,7 @@
 }
 
 /* Draws page border around the provided content, taking an optional function to be called at the footer. */
-#let apply-page-borders(body, ..font-options, footer-special-func: none, page-numbering: none) = {
+#let apply-page-borders(body, font-options: (), footer-special-func: none, page-numbering: none) = {
   let page-margin = (left: 0.75in, right: 0.25in, top: 0.25in, bottom: 0.25in)
   let margin = (left: 0.65in, right: 0.15in, top: 1.5em, bottom: 1.5em)
   let page-border-thickness = 1.25pt
@@ -74,12 +74,19 @@
   show raw.where(block: true): it => align(left, it)
   set list(marker: ([$square.filled.tiny$], [--]))
   set par(leading: 0.5em)
-  apply-page-borders(body, ..body-font-settings, footer-special-func: signature-footer, page-numbering: page-numbering)
+  apply-page-borders(body, font-options: body-font-settings, footer-special-func: signature-footer, page-numbering: page-numbering)
 }
 
-#let scos(name, pad: none) = {
+#let scos(name, pad: none, include-before: ()) = {
   v(1em)
   [=== Source Code]
+  if include-before.len() != 0 {
+    for file in include-before {
+      [==== File: #raw(lang: "text", file + ".java")]
+      highlight-code-file("/code/" + file + ".java")
+    }
+    [==== Main file: #raw(lang: "text", name + "java")]
+  }
   highlight-code-file("/code/" + name + ".java")
   if pad != none { v(pad) }
   [=== Output]
@@ -90,10 +97,10 @@
 
 #let alist = state("assignment-list", ())
 
-#let list-of-assignments(cb) = locate(loc => {
-  let l = alist.final(loc)
-  let lpno = counter(page).final(loc).first()
-  cb(l, lpno)
+#let list-of-assignments(contents) = locate(loc => {
+  let assignment-list = alist.final(loc)
+  let last-page-number = counter(page).final(loc).first()
+  contents(assignment-list, last-page-number)
 })
 
 #let list-of-dates = ([11/09/2023], [16/09/2023], [26/09/2023], [04/10/2023], [09/10/2023], [10/10/2023], [13/10/2023], [16/10/2023], [21/11/2023], [28/11/2023], [02/12/2023], [04/12/2023], [04/12/2023], [05/12/2023], [19/12/2023], [02/01/2024], [08/01/2024], [09/01/2024], [15/01/2024], [18/01/2024])
@@ -114,8 +121,7 @@
     ] else [
 == #text(weight: 500, [Program statement:]) #text(weight: 400, description)
     ]
-    let desc = if pad { [#description \ \ ] } else { description }
-    locate(loc => alist.update(lst => (..lst, (number: number, description: desc, page-number: counter(page).at(loc).first(), date: date))))
+    locate(loc => alist.update(lst => (..lst, (number: number, description: description, page-number: counter(page).at(loc).first(), date: date))))
   }
 ])