summary refs log tree commit diff stats
path: root/java
diff options
context:
space:
mode:
authorSudipto Mallick <smlckz@termux-alpine>2024-01-27 11:22:14 +0000
committerSudipto Mallick <smlckz@termux-alpine>2024-01-27 11:22:14 +0000
commit1db2841d10c6920eba89f1e55eb3c90aa770ad07 (patch)
tree8d47fc838268f66b78e010e02319178fe19ae97c /java
parent36873dd5ac49508b455096e1755740788c49a26f (diff)
downloadzadania-1db2841d10c6920eba89f1e55eb3c90aa770ad07.tar.gz
Add support for dates of Java assignments
Diffstat (limited to 'java')
-rw-r--r--java/prelude.typ7
-rw-r--r--java/template.typ13
2 files changed, 12 insertions, 8 deletions
diff --git a/java/prelude.typ b/java/prelude.typ
index 41eedc5..09e239e 100644
--- a/java/prelude.typ
+++ b/java/prelude.typ
@@ -21,10 +21,9 @@
     let new-assignment-list = ()
     index = 0
     for (start, end) in page-number-list {
-      let page-number = [#start - #end]
-      if start == end { page-number = [#start] }
+      let page-number = if start == end [#start] else [#start - #end]
       let assignment = assignment-list.at(index)
-      let item = ([#{assignment.number}. ], assignment.description, page-number, [], [])
+      let item = ([#{assignment.number}. ], assignment.description, page-number, assignment.date, [])
       new-assignment-list.push(item)
       index = index + 1
     }
@@ -32,7 +31,7 @@
   }
   #list-of-assignments((assignment-list, last-page-number) =>
     tablex(
-      columns: (3em, 1fr, 4em, 8em, 10em),
+      columns: (3em, 1fr, 4em, 6em, 11em),
       stroke: 1pt + gray,
       map-cols: (i, cells) => (cells.first(), ..cells.slice(1).map(cell => (..cell, align: column-alignments.at(i)))),
       heading-format[*Sl.* \ *No.*], heading-format[*Description*], heading-format[*Page No.*], heading-format[*Date*], heading-format[*Teacher’s* \ *Signature*],
diff --git a/java/template.typ b/java/template.typ
index 0d85269..ecaa5da 100644
--- a/java/template.typ
+++ b/java/template.typ
@@ -77,10 +77,11 @@
   apply-page-borders(body, ..body-font-settings, footer-special-func: signature-footer, page-numbering: page-numbering)
 }
 
-#let scos(name) = {
+#let scos(name, pad: none) = {
   v(1em)
   [=== Source Code]
   highlight-code-file("/code/" + name + ".java")
+  if pad != none { v(pad) }
   [=== Output]
   v(-1em)
   let ofname = "/output/" + name + ".typ" 
@@ -95,9 +96,15 @@
   cb(l, lpno)
 })
 
+#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])
+#let assignment-dates-indices = (1, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 16, 17, 18)
+
 #let assignment(number, description, block: false, reduce-gap: false, pad: false) = align(center, [
 = #text(weight: 600, [Assignment #number])
   #{
+    let date = list-of-dates.at(assignment-dates-indices.at(number - 1) - 1)
+    v(-1.65em)
+    align(right, [Date: #date])
     if reduce-gap { v(-0.75em) }
     if block == true [
       #set par(justify: true)
@@ -107,10 +114,8 @@
     ] 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()))))
+    locate(loc => alist.update(lst => (..lst, (number: number, description: desc, page-number: counter(page).at(loc).first(), date: date))))
   }
 ])