refine coursework v2 task fields

This commit is contained in:
ilyaoc
2026-05-20 12:37:09 +02:00
parent c9c0577ec8
commit cf8c2c8338
4 changed files with 67 additions and 13 deletions
+13 -2
View File
@@ -6,6 +6,7 @@
#import "./utils.typ"
#let dstu-table = style.dstu-table
#let hfill = utils.hfill
/// Coursework template for NURE
/// - university (str): University code, default "ХНУРЕ"
@@ -31,7 +32,8 @@
bib-path: none,
appendices: (),
) = {
set document(title: title, author: authors.map(c => c.name))
let doc-title = if type(title) == array { title.join(" ") } else { title }
set document(title: doc-title, author: authors.map(c => c.name))
show: style.dstu.with(skip: 1)
@@ -66,6 +68,7 @@
/// - task-list (dict): Task metadata
/// - calendar-plan (dict): Calendar plan table
/// - abstract (dict): Keywords and abstract text
/// - abstract-en (dict): Optional English keywords and abstract text
/// - bib-path (str): Path to bibliography file
/// - appendices (content): Appendix content
#let coursework-v2(
@@ -77,6 +80,7 @@
task-list: (),
calendar-plan: (),
abstract: (),
abstract-en: none,
bib-path: none,
appendices: (),
faculty: "комп’ютерних наук",
@@ -87,7 +91,8 @@
assert(authors.len() > 0, message: "At least one author required")
assert(mentors.len() > 0, message: "At least one mentor required")
set document(title: title, author: authors.map(c => c.name))
let doc-title = if type(title) == array { title.join(" ") } else { title }
set document(title: doc-title, author: authors.map(c => c.name))
show: style.dstu.with(skip: 1)
@@ -97,6 +102,12 @@
bib-count.update(((..c)) => (..c, it.key))
}
let abstract = if abstract-en != none {
abstract + (en: abstract-en)
} else {
abstract
}
tp.cw-v2.nure(
university,
title,
+7 -8
View File
@@ -1,7 +1,7 @@
#import "../../shared.typ": universities
#import "../../helpers.typ": *
#import "../../style.typ": spacing
#import "../../utils.typ": bold, uline
#import "../../utils.typ": bold, uline, filled-lines
#let note(content) = block(width: 100%, above: 5pt, below: 0pt)[
#set text(size: 10pt)
@@ -69,7 +69,7 @@
#let task-num(n) = box(str(n) + ".")
#let title-field(value) = {
uline(align: center, value)
uline(align: center, filled-lines(value))
uline(align: center, [])
note[(тема)]
}
@@ -126,7 +126,7 @@
#set align(left)
#inline-label-line(
[Факультет],
faculty + " (або центр післядипломної освіти, або навчально-науковий центр заочної форми навчання)",
faculty,
)
#note([(повна назва)])
@@ -201,8 +201,7 @@
(
[Факультет],
(
faculty + " (або центр післядипломної освіти, або",
"навчально-науковий центр заочної форми навчання)",
faculty,
),
),
([Кафедра], edu-prog.department-gen),
@@ -234,20 +233,20 @@
#v(1.0em)
#task-num(1) Тема роботи #uline(align: left)[#title]
#task-num(1) Тема роботи #uline(align: left, filled-lines(title))
#v(0.4em)
#task-num(2) Термін здачі студентом закінченої роботи
“#underline(task-list.done-date.display("[day]"))” #underline(month-gen(task-list.done-date.month())) #task-list.done-date.display("[year]")р.
#v(0.4em)
#task-num(3) Вихідні дані до проєкту #uline(align: left, task-list.at("source", default: []))
#task-num(3) Вихідні дані до проєкту #uline(align: left, filled-lines(task-list.at("source", default: [])))
#v(0.4em)
#uline(align: left, [])
#v(0.4em)
#task-num(4) Перелік питань, що потрібно опрацювати в роботі\
#uline(align: left, task-list.at("content", default: []))
#uline(align: left, filled-lines(task-list.at("content", default: [])))
#v(0.4em)
#uline(align: left, [])
+7
View File
@@ -7,6 +7,13 @@
/// fill horizontal space with a filled box
#let hfill(width) = box(width: width, repeat("")) // HAIR SPACE (U+200A)
/// convert an array of lines into filled lines for underlined task fields
#let filled-lines(content) = if type(content) == array {
content.map(line => [#line #hfill(1fr)]).join(linebreak())
} else {
content
}
/// underlined cell with centered content by default
#let uline(align: center, content) = underline[
#if align != left { hfill(1fr) }