summary refs log tree commit diff stats
path: root/mysql-php/contents.typ
diff options
context:
space:
mode:
authorSudipto Mallick <smlckz@termux-alpine>2024-02-08 11:08:33 +0000
committerSudipto Mallick <smlckz@termux-alpine>2024-02-08 11:08:33 +0000
commit02884d29e4f5aea71364a203dcaecd53600d8aa4 (patch)
tree0047b71f3677132fd6319919233e8ce5da43ad6d /mysql-php/contents.typ
parent0ac38a6f4ce7144635525a5a73bf2946d2909fa6 (diff)
downloadzadania-02884d29e4f5aea71364a203dcaecd53600d8aa4.tar.gz
Complete PHP assignments
Diffstat (limited to 'mysql-php/contents.typ')
-rw-r--r--mysql-php/contents.typ49
1 files changed, 49 insertions, 0 deletions
diff --git a/mysql-php/contents.typ b/mysql-php/contents.typ
new file mode 100644
index 0000000..6f7e302
--- /dev/null
+++ b/mysql-php/contents.typ
@@ -0,0 +1,49 @@
+#import "@preview/tablex:0.0.7": tablex, cellx
+#import "/tpl.typ": apply, signature, list-of-assignments, apply-page-borders
+
+#apply(page-numbering: "(i)" , [
+  #let heading-format(content) = cellx(align: center + horizon, content)
+  #let column-alignments = (right, auto, center + horizon, center + horizon, auto)
+  #let preprocess-alist(assignment-list, last-page-number) = {
+    let index = 0
+    let last-index = assignment-list.len() - 1
+    let page-number-list = ()
+    while index < last-index {
+      let item = assignment-list.at(index)
+      let next-item = assignment-list.at(index + 1)
+      let starting-page-number = item.page-number
+      let finishing-page-number = next-item.page-number - 1
+      page-number-list.push((starting-page-number, finishing-page-number))
+      index = index + 1
+    }
+    page-number-list.push((assignment-list.at(last-index).page-number, last-page-number))
+    let new-assignment-list = ()
+    index = 0
+    for (start, end) in page-number-list {
+      let page-number = if start == end [#start] else [#start - #end]
+      let assignment = assignment-list.at(index)
+      let serial-number = [#{assignment.number}. ]
+      let description = stack(dir: ltr, v(5em), assignment.description)
+      let item = (serial-number, description, page-number, assignment.date, [])
+      new-assignment-list.push(item)
+      index = index + 1
+    }
+    new-assignment-list
+  }
+  #list-of-assignments((assignment-list, last-page-number) => {
+    counter(page).update(1)
+    align(center, [== Contents])
+    tablex(
+      columns: (3em, 1fr, 4em, 6em, 11em),
+      stroke: 1pt + gray,
+      repeat-header: true,
+      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*],
+      ..preprocess-alist(assignment-list, last-page-number).flatten(),
+    )
+    // signature()
+  })
+])
+
+#colbreak()
+