1
0

feat!: rename "lab-pz-template" to "pz-lb-template"

feat!: make authors.*.edu_program optional, derive it from edu_program_short instead
docs: minor changes to readme and lab template
This commit is contained in:
2025-03-12 23:02:32 +02:00
parent cf10e0fbdc
commit 0b8ceda4f1
3 changed files with 23 additions and 17 deletions

View File

@ -40,12 +40,16 @@ typst init @local/nure:0.0.0 project-name
Include lib.typ in your project and utilize the provided functions: Include lib.typ in your project and utilize the provided functions:
```typst ```typst
// Import the template // Import the template either from a local package...
#import "lib.typ": * #import "@local/nure:0.0.0": *
// ...or by importing a lib.typ directly from a project's root directory
// #import "lib.typ": *
// Setup the document // Setup the document
#show: lab-pz-template.with( #show: pz-lb-template.with(
title: "Some title", title: "Some title",
// etc: "and so on",
// ...
) )
// this template automatically inserts a `=title` // this template automatically inserts a `=title`

28
lib.typ
View File

@ -15,14 +15,16 @@
/// education program abbreviations to name & number /// education program abbreviations to name & number
#let edu_programs = ( #let edu_programs = (
"ПЗПІ": ( "ПЗПІ": (
name: "ПЗПІ", // i don't like it
name-long: "Інженерія програмного забезпечення",
department_gen: "Програмної інженерії", department_gen: "Програмної інженерії",
name: "Інженерія програмного забезпечення", code: 121, // TODO: ПЗПІ is "F2" now
number: 121, // TODO: ПЗПІ is "F2" now
), ),
"КУІБ": ( "КУІБ": (
name: "КУІБ", // i don't like it
name-long: "Управління інформаційною безпекою",
department_gen: "Інфокомунікацій", department_gen: "Інфокомунікацій",
name: "Управління інформаційною безпекою", code: 125,
number: 125,
), ),
) )
@ -393,7 +395,7 @@
linebreak() linebreak()
uline(align: left, subjects.at(subject_short)) uline(align: left, subjects.at(subject_short))
linebreak() linebreak()
uline(align: left, [#edu_program.number #edu_program.name]) uline(align: left, [#edu_program.code #edu_program.name-long])
}, },
) )
grid( grid(
@ -667,16 +669,16 @@
/// - subject_short (str): Subject short name. /// - subject_short (str): Subject short name.
/// - worknumber (int): Number of the work, can be omitted. /// - worknumber (int): Number of the work, can be omitted.
/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts. /// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts.
/// - mentors (name: str, gender: str or none, degree: str): Mentors objects. /// - mentors ((name: str, degree: str, gender: str or none): Mentors objects.
#let lab-pz-template( #let pz-lb-template(
doc, doc,
doctype: "NONE", doctype: none,
edu_program_short: "ПЗПІ", edu_program_short: edu_programs.keys().first(),
title: "NONE", title: none,
subject_short: "NONE", subject_short: none,
worknumber: 1, worknumber: 1,
authors: (), authors: (),
mentors: (gender: none), mentors: (),
) = { ) = {
set document(title: title, author: authors.at(0).name) set document(title: title, author: authors.at(0).name)
@ -713,7 +715,7 @@
let author = authors.at(0) let author = authors.at(0)
if author.gender == "m" [Виконав:\ ] else [Виконала:\ ] if author.gender == "m" [Виконав:\ ] else [Виконала:\ ]
[ [
ст. гр. #author.edu_program\-#author.group\ ст. гр. #edu_program.name\-#author.group\
#author.name\ #author.name\
] ]
if author.variant != none [Варіант: #author.variant] if author.variant != none [Варіант: #author.variant]

View File

@ -1,6 +1,6 @@
#import "@local/nure:0.0.0": * #import "@local/nure:0.0.0": *
#show: lab-pz-template.with( #show: pz-lb-template.with(
doctype: "ЛБ", doctype: "ЛБ",
edu_program_short: "ПЗПІ", edu_program_short: "ПЗПІ",
title: "Інформаційна система «Помічник класного керівника». Керування класом", title: "Інформаційна система «Помічник класного керівника». Керування класом",