diff --git a/config/universities.yaml b/config/universities.yaml index f240525..67a4471 100644 --- a/config/universities.yaml +++ b/config/universities.yaml @@ -10,6 +10,7 @@ name_long: Управління інформаційною безпекою department_gen: Інфокомунікаційної інженерії ім. В. В. Поповського code: 125 # TODO: change to F5? + description: Кібербезпека та захист інформації КНТ: name_en: CST # computer sciences and technologies name_long: Комп'ютерні науки та технології diff --git a/src/layouts/pz-lb/complex.typ b/src/layouts/pz-lb/complex.typ new file mode 100644 index 0000000..14228df --- /dev/null +++ b/src/layouts/pz-lb/complex.typ @@ -0,0 +1,81 @@ +// Title page layouts for pz-lb {{{1 +// This module provides different title page layouts for practice/lab work templates + +#import "/src/helpers.typ": gender-form, gender-get, pz-lb-title, uline + +/// Default DSTU title page layout (ministry + university header, 2-column author/mentor info) +/// Returns: content for the title page + +/// Simple title page layout (university header only, single column layout) +/// Returns: content for the title page + +#let complex( + uni, + edu_program, + subject, + type, + number, + title, + authors, + mentors, +) = { + align(center)[ + Міністерство освіти і науки України\ + #uni.name + + \ + #set par(first-line-indent: 0pt) + #align(left)[ + #let edu = uni.edu_programs.at(edu_program) + Кафедра #underline(edu.department_gen)\ + Спеціальність #underline([#edu.code #edu.description])\ + Освітня програма #underline(edu.name_long) + ] + + \ \ + + #pz-lb-title(type, number: number) + + з навчальної дисципліни "#uni.subjects.at(subject, default: subject)" + #if title != none [\ з теми "#eval(title, mode: "markup")"] + #if authors.first().variant != none [\ Варіант №#authors.first().variant] + + \ \ \ + + #align(right)[ + #if authors.len() == 1 { + let a = authors.first() + [#gender-form("author", gender: gender-get(a)):\ ] + [студент групи #a.edu_program\-#a.group\ #a.name\ ] + text(size: 10pt, [(прізвище та ініціали)\ ]) + } else if authors.len() > 1 [ + #gender-form("author"):\ + #for a in authors [студент групи #a.edu_program\-#a.group\ #a.name\ ] + #text(size: 10pt, [(прізвище та ініціали)\ ]) + ] + + \ + + #if mentors.len() == 1 { + let m = mentors.first() + [#gender-form("mentor", gender: gender-get(m)):\ ] + if "degree" in m.keys() and m.degree != none [#m.degree\ ] + [#m.name\ ] + text(size: 10pt, [(прізвище та ініціали)\ ]) + } else if mentors.len() > 1 [ + #gender-form("mentor"):\ + #for m in mentors { + if "degree" in m.keys() and m.degree != none [#m.degree\ ] + [#m.name\ ] + } + ] + ] + + #v(1fr) + + Харків\ + #datetime.today().display("[year]") + ] +} + +// vim:sts=2:sw=2:fdm=marker:cms=/*%s*/ diff --git a/src/layouts/pz-lb/minimal.typ b/src/layouts/pz-lb/minimal.typ index 0c5e8a2..44ee488 100644 --- a/src/layouts/pz-lb/minimal.typ +++ b/src/layouts/pz-lb/minimal.typ @@ -2,7 +2,7 @@ #let minimal( uni, - edu_program, + edu-program, subject, type, number, @@ -15,7 +15,7 @@ #upper(uni.name) \ \ - Кафедра #uni.edu_programs.at(edu_program).department_gen + Кафедра #uni.edu_programs.at(edu-program).department_gen \ \ \ #pz-lb-title(type, number: number) diff --git a/src/layouts/pz-lb/simple.typ b/src/layouts/pz-lb/simple.typ deleted file mode 100644 index 405fce6..0000000 --- a/src/layouts/pz-lb/simple.typ +++ /dev/null @@ -1,66 +0,0 @@ -// Title page layouts for pz-lb {{{1 -// This module provides different title page layouts for practice/lab work templates - -#import "/src/helpers.typ": gender-form, gender-get, pz-lb-title - -/// Default DSTU title page layout (ministry + university header, 2-column author/mentor info) -/// Returns: content for the title page - -/// Simple title page layout (university header only, single column layout) -/// Returns: content for the title page - -#let simple( - uni, - edu_program, - subject, - type, - number, - title, - authors, - mentors, -) = { - align(center)[ - #upper(uni.name) - Кафедра #uni.edu_programs.at(edu_program).department_gen - - \ \ \ - - #pz-lb-title(type, number: number) - - з дисципліни: "#uni.subjects.at(subject, default: subject)" - #if title != none [\ з теми: "#eval(title, mode: "markup")"] - - \ \ \ - - #if authors.len() == 1 { - let a = authors.first() - [#gender-form("author", gender: gender-get(a)):\ #a.name] - [ст. гр. #a.edu_program\-#a.group] - if a.variant != none [Варіант: №#a.variant] - } else if authors.len() > 1 [ - #gender-form("author"):\ - #for a in authors [#a.name (ст. гр. #a.edu_program\-#a.group)\ ] - ] - - \ - - #if mentors.len() == 1 { - let m = mentors.first() - [#gender-form("mentor", gender: gender-get(m)):\ ] - if "degree" in m.keys() and m.degree != none [#m.degree ] - [#m.name] - } else if mentors.len() > 1 [ - #gender-form("mentor"):\ - #for m in mentors { - if "degree" in m.keys() and m.degree != none [#m.degree\ ] - [#m.name\ ] - } - ] - - #v(1fr) - - #datetime.today().display("[year]") - ] -} - -// vim:sts=2:sw=2:fdm=marker:cms=/*%s*/ diff --git a/src/lib.typ b/src/lib.typ index 7ee98da..006ee31 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -368,10 +368,10 @@ // TODO: add actually relevant asserts import "layouts/pz-lb/minimal.typ": * - import "layouts/pz-lb/simple.typ": * + import "layouts/pz-lb/complex.typ": * let edu-program = if edu-program != none { edu-program } else if true { - authors.first().edu-program + authors.first().edu_program } let uni = universities.at(university) @@ -381,8 +381,8 @@ // page 1 {{{2 - if layout == "simple" { - simple(uni, edu-program, subject, type, number, title, authors, mentors) + if layout == "complex" { + complex(uni, edu-program, subject, type, number, title, authors, mentors) } else { minimal(uni, edu-program, subject, type, number, title, authors, mentors) } diff --git a/test-layouts.typ b/test-layouts.typ index 503ba7f..0cf2df1 100644 --- a/test-layouts.typ +++ b/test-layouts.typ @@ -1,28 +1,29 @@ -#import "lib.typ": * +#import "/src/lib.typ": * -#set document(title: "Тест лейаутів", author: "Іванов І.І.") +// #set document(title: "Тест лейаутів", author: "Іванов І.І.") #let authors = ( ( name: "Іванов І.І.", full_name_gen: "Іванова Івана Івановича", - edu_program: "ПЗПІ", + edu_program: "КУІБ", group: "23-1", variant: 5, ), ) #let mentors = ( - (name: "Петров П.П.", degree: "доц."), + (name: "Петров П.П.", degree: "доцент кафедри ІКІ"), ) // Тест default лейауту #show: pz-lb.with( - layout: "default", + layout: "complex", subject: "БД", + edu-program: "КУІБ", type: "ЛБ", number: 2, - // title: "SQL запити", + title: "SQL запити", authors: authors, mentors: mentors, ) @@ -35,7 +36,7 @@ subject: "БД", type: "ЛБ", number: 2, - // title: "SQL запити", + title: "SQL запити", authors: authors, mentors: mentors, )