From b8a309ad2c754c48318219e4e6ed18acf10b2cc5 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 19:08:41 +0200 Subject: [PATCH 01/19] feat!: change mentor to mentors for lab-pz feat: implement plural mentor referral fix: added subject and edu_program style: format with typstyle --- lib.typ | 95 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 17 deletions(-) diff --git a/lib.typ b/lib.typ index e4c4a15..f03c9fd 100644 --- a/lib.typ +++ b/lib.typ @@ -4,6 +4,7 @@ /// subject abbreviations to full names #let subjects = ( "БД": "Бази даних", + "ОТК": "Основи теорії кіл", "ОПНJ": "Основи програмування на Java", "ОС": "Операційні системи", "ПП": "Проектний практикум", @@ -17,6 +18,10 @@ name: "Інженерія програмного забезпечення", number: 121, // TODO: ПЗПІ is "F2" now ), + "КУІБ": ( + name: "Управління інформаційною безпекою", + number: 125, + ), ) // Template formatting functions {{{1 @@ -25,7 +30,10 @@ #let nheading(title) = heading(depth: 1, numbering: none, title) /// fill horizontal space with a box and not an empty space -#let hfill(width) = box(width: width, repeat(" ")) // NOTE: This is a HAIR SPACE (U+200A), not a regular space +#let hfill(width) = box( + width: width, + repeat(" "), +) // NOTE: This is a HAIR SPACE (U+200A), not a regular space /// make underlined cell with filled value #let uline(align: center, content) = underline[ @@ -68,7 +76,9 @@ #let img(path, caption, ..sink) = { let parts = path.split(".").first().split("/") - let label_string = if parts.len() <= 2 or parts.at(-1).starts-with(parts.at(-2)) { + let label_string = if ( + parts.len() <= 2 or parts.at(-1).starts-with(parts.at(-2)) + ) { // ("image",), (_, "image") and (.., "img", "img_image") parts.last() } else { @@ -107,7 +117,12 @@ }, ) - set text(font: ("Times New Roman", "Liberation Serif"), size: 14pt, hyphenate: false, lang: "uk") + set text( + font: ("Times New Roman", "Liberation Serif"), + size: 14pt, + hyphenate: false, + lang: "uk", + ) set par(justify: true, first-line-indent: (amount: 1.25cm, all: true)) set underline(evade: false) @@ -117,7 +132,11 @@ set par(leading: spacing) // enums and lists {{{2 - set enum(numbering: i => { ua_alpha_numbering.at(i) + ")" }, indent: 1.25cm, body-indent: 0.5cm) + set enum( + numbering: i => { ua_alpha_numbering.at(i) + ")" }, + indent: 1.25cm, + body-indent: 0.5cm, + ) show enum: it => { set enum(indent: 0em, numbering: "1)") it @@ -144,8 +163,20 @@ counter(figure.where(kind: raw)).update(0) it } - set math.equation(numbering: (..num) => numbering("(1.1)", counter(heading).get().at(0), num.pos().first())) - set figure(numbering: (..num) => numbering("1.1", counter(heading).get().at(0), num.pos().first())) + set math.equation( + numbering: (..num) => numbering( + "(1.1)", + counter(heading).get().at(0), + num.pos().first(), + ), + ) + set figure( + numbering: (..num) => numbering( + "1.1", + counter(heading).get().at(0), + num.pos().first(), + ), + ) // appearance of references to images and tables {{{2 set ref( @@ -368,7 +399,9 @@ grid( columns: (1fr, 1fr, 1fr), gutter: 0.3fr, - [#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)], + [#bold[Курс] #uline(2)], + [#bold[Група] #uline(author.group)], + [#bold[Семестр] #uline(3)], ) linebreak() @@ -489,18 +522,27 @@ #{ let keywords = abstract.keywords.map(upper) - let is_cyrillic = word => word.split("").any(char => ("А" <= char and char <= "я")) + let is_cyrillic = word => word + .split("") + .any(char => ("А" <= char and char <= "я")) let n = keywords.len() for i in range(n) { for j in range(0, n - i - 1) { if ( - (not is_cyrillic(keywords.at(j)) and is_cyrillic(keywords.at(j + 1))) + ( + not is_cyrillic(keywords.at(j)) + and is_cyrillic(keywords.at(j + 1)) + ) or ( - is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) and keywords.at(j) > keywords.at(j + 1) + is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) + and keywords.at(j) > keywords.at(j + 1) ) ) { - (keywords.at(j), keywords.at(j + 1)) = (keywords.at(j + 1), keywords.at(j)) + (keywords.at(j), keywords.at(j + 1)) = ( + keywords.at(j + 1), + keywords.at(j), + ) } } } @@ -571,7 +613,10 @@ } context { - for (i, citation) in query(ref.where(element: none)).map(r => str(r.target)).dedup().enumerate() { + for (i, citation) in query(ref.where(element: none)) + .map(r => str(r.target)) + .dedup() + .enumerate() { enum.item( i + 1, format-entry(bib_data.at(citation)), @@ -631,7 +676,7 @@ /// - department_gen (str): Department name in genitive form. /// - 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. -/// - mentor (name: str, gender: str, degree: str): Mentors objects. +/// - mentors (name: str, gender: str or none, degree: str): Mentors objects. #let lab-pz-template( doc, doctype: "NONE", @@ -640,7 +685,7 @@ department_gen: "Програмної інженерії", worknumber: 1, authors: (), - mentor: (), + mentors: (), ) = { set document(title: title, author: authors.at(0).name) @@ -688,9 +733,25 @@ #colbreak() #set align(right) - #if mentor.gender == "m" { [Перевірив:\ ] } else { [Перевірила:\ ] } - #mentor.degree #if mentor.degree.len() >= 15 [\ ] - #mentor.name\ + #if mentors.len() == 1 { + let mentor = mentors.at(0) + if mentor.gender == none [Перевірили:\ ] else if ( + mentor.gender == "m" + ) [Перевірив:\ ] else [Перевірилa:\ ] + [ + #let mentor = mentors.at(0) + #mentor.degree\ + #mentor.name\ + ] + } else [ + Перевірили:\ + #for mentor in mentors { + [ + #mentor.degree\ + #mentor.name\ + ] + } + ] ] #v(1fr) From 0e0dc20e9b23b57717bb357389b1cf57eac1c9fd Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 19:11:06 +0200 Subject: [PATCH 02/19] fix: remove unnecessary variable --- lib.typ | 1 - 1 file changed, 1 deletion(-) diff --git a/lib.typ b/lib.typ index f03c9fd..7377505 100644 --- a/lib.typ +++ b/lib.typ @@ -739,7 +739,6 @@ mentor.gender == "m" ) [Перевірив:\ ] else [Перевірилa:\ ] [ - #let mentor = mentors.at(0) #mentor.degree\ #mentor.name\ ] From 33d067b67e0e775b4bbfbb018eab617f5735e348 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 20:24:48 +0200 Subject: [PATCH 03/19] feat!: move department_gen to edu_programs feat!: rename "shorthand" variables to "short" WIP: feat!: derive group name from edu_program docs(template): adjust templates accordingly style: format with typstyle --- lib.typ | 38 +++++++++++---------- template/coursework.typ | 76 ++++++++++++++++++++++++++--------------- template/lab.typ | 10 +++--- 3 files changed, 73 insertions(+), 51 deletions(-) diff --git a/lib.typ b/lib.typ index 7377505..dc50885 100644 --- a/lib.typ +++ b/lib.typ @@ -15,10 +15,12 @@ /// education program abbreviations to name & number #let edu_programs = ( "ПЗПІ": ( + department_gen: "Програмної інженерії", name: "Інженерія програмного забезпечення", number: 121, // TODO: ПЗПІ is "F2" now ), "КУІБ": ( + department_gen: "Інфокомунікацій", name: "Управління інформаційною безпекою", number: 125, ), @@ -264,11 +266,10 @@ /// -> content /// - doc (content): Content to apply the template to. /// - title (str): Title of the document. -/// - subject_shorthand (str): Subject short name. -/// - department_gen (str): Department name in genitive form. +/// - subject_short (str): Subject short name. /// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts. /// - mentors ((name: str, gender: str, degree: str),): List of mentors dicts. -/// - edu_program_shorthand (str): Education program shorthand. +/// - edu_program_short (str): Education program shorthand. /// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object. /// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object. /// - abstract (keywords: (str, ), text: (content | str)): Abstract object. @@ -277,11 +278,10 @@ #let cw-template( doc, title: "NONE", - subject_shorthand: "NONE", - department_gen: "Програмної інженерії", + subject_short: "NONE", author: (), mentors: (), - edu_program_shorthand: "ПЗПІ", + edu_program_short: "ПЗПІ", task_list: (), calendar_plan: (), abstract: (), @@ -304,7 +304,7 @@ let head_mentor = mentors.at(0) - let edu_program = edu_programs.at(edu_program_shorthand) + let edu_program = edu_programs.at(edu_program_short) // page 1 {{{2 [ @@ -323,7 +323,7 @@ ДО КУРСОВОЇ РОБОТИ - з дисципліни: "#subjects.at(subject_shorthand, default: "NONE")" + з дисципліни: "#subjects.at(subject_short, default: "NONE")" Тема роботи: "#title" @@ -389,9 +389,9 @@ Спеціальність ], { - uline(align: left, department_gen) + uline(align: left, edu_program.department_gen) linebreak() - uline(align: left, subjects.at(subject_shorthand)) + uline(align: left, subjects.at(subject_short)) linebreak() uline(align: left, [#edu_program.number #edu_program.name]) }, @@ -671,26 +671,28 @@ /// -> content /// - doc (content): Content to apply the template to. /// - doctype ("ЛБ" | "ПЗ"): Document type. +/// - edu_program_short (str): Education program shorthand. /// - title (str): Title of the document. -/// - subject_shorthand (str): Subject short name. -/// - department_gen (str): Department name in genitive form. +/// - subject_short (str): Subject short name. /// - 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. /// - mentors (name: str, gender: str or none, degree: str): Mentors objects. #let lab-pz-template( doc, doctype: "NONE", + edu_program_short: "ПЗПІ", title: "NONE", - subject_shorthand: "NONE", - department_gen: "Програмної інженерії", + subject_short: "NONE", worknumber: 1, authors: (), - mentors: (), + mentors: (gender: none), ) = { set document(title: title, author: authors.at(0).name) show: style + let edu_program = edu_programs.at(edu_program_short) + context counter(heading).update(worknumber - 1) // page 1 {{{2 @@ -699,7 +701,7 @@ ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ \ \ - Кафедра #department_gen + Кафедра #edu_program.department_gen \ \ \ Звіт \ @@ -707,7 +709,7 @@ #if doctype == "ЛБ" [лабораторної роботи] else [практичної роботи] #if worknumber != none [№ #worknumber] - з дисципліни: "#subjects.at(subject_shorthand, default: "UNLNOWN SUBJECT, PLEASE OPEN AN ISSUE")" + з дисципліни: "#subjects.at(subject_short, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")" з теми: "#title" @@ -720,7 +722,7 @@ let author = authors.at(0) if author.gender == "m" [Виконав:\ ] else [Виконала:\ ] [ - ст. гр. #author.group\ + ст. гр. #author.edu_program\-#author.group\ #author.name\ ] if author.variant != none [Варіант: №#author.variant] diff --git a/template/coursework.typ b/template/coursework.typ index 9393607..e3509ce 100644 --- a/template/coursework.typ +++ b/template/coursework.typ @@ -4,26 +4,14 @@ name: "Ситник Є. С.", full_name_gen: "Ситника Єгора Сергійовича", variant: 13, - group: "ПЗПІ-23-2", + group: "23-2", gender: "m", ) #let mentors = ( - ( - name: "Черепанова Ю. Ю.", - gender: "f", - degree: "Ст. викл. каф. ПІ", - ), - ( - name: "Русакова Н. Є.", - gender: "f", - degree: "Доц. каф. ПІ", - ), - ( - name: "Широкопетлєва М. С.", - gender: "f", - degree: "Ст. викл. каф. ПІ", - ), + (name: "Черепанова Ю. Ю.", gender: "f", degree: "Ст. викл. каф. ПІ"), + (name: "Русакова Н. Є.", gender: "f", degree: "Доц. каф. ПІ"), + (name: "Широкопетлєва М. С.", gender: "f", degree: "Ст. викл. каф. ПІ"), ) #let task_list = ( @@ -38,19 +26,39 @@ plan_table: table( columns: 4, align: (center, left, center, center), - [Номер], [Назва етапів курсової роботи], [Строк виконання етапів роботи], [Примітки], + [Номер], + [Назва етапів курсової роботи], + [Строк виконання етапів роботи], + [Примітки], + [1], [Аналіз предметної області], [15.09.24 – 24.09.24], [Виконано], [2], [Концептуальне моделювання], [24.09.24-30.09.24], [~], [2], [Постановка задачі], [28.09.24 – 2.10.24], [Виконано], [3], [Побудова ER-діаграми та схеми БД], [2.10.24 – 18.10.24], [Виконано], - [4], [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], [10.10.24 - 18.10.24], [Виконано], + [4], + [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], + [10.10.24 - 18.10.24], + [Виконано], + [5], [Перша контрольна точка з курсової роботи], [20.10.24], [Виконано], [6], [Нормалізація бази даних], [20.10.24 - 15.11.24], [Виконано], [7], [Створення програми], [20.10.24 – 20.11.24], [Виконано], - [8], [Тестування програми, наповнення бази даних], [20.11.24 - 5.12.24], [Виконано], + [8], + [Тестування програми, наповнення бази даних], + [20.11.24 - 5.12.24], + [Виконано], + [9], [Друга контрольна точка з курсової роботи], [7.12.24], [Виконано], - [10], [Реалізація остаточної версії програми], [7.12.24-15.12.24], [Виконано], - [11], [Оформлення інших розділів пояснювальної записки], [1.11.24 – 25.12.24], [Виконано], + [10], + [Реалізація остаточної версії програми], + [7.12.24-15.12.24], + [Виконано], + + [11], + [Оформлення інших розділів пояснювальної записки], + [1.11.24 – 25.12.24], + [Виконано], + [12], [Третя контрольна точка з курсової роботи], [27.12.24], [Виконано], ), approval_date: datetime(year: 2024, month: 12, day: 27), @@ -69,11 +77,26 @@ "SQL", ), text: [ - Мета даної роботи -- проєктування та розробка інформаційної системи «Помічник класного керівника. Керування класом», яка спрямована на автоматизацію процесів управління класом, облік даних про учнів, планування та аналіз навчального процесу. Основна задача інформаційної системи – спростити роботу класного керівника, забезпечити ефективну організацію документації та взаємодію з учасниками освітнього процесу. + Мета даної роботи -- проєктування та розробка інформаційної системи «Помічник + класного керівника. Керування класом», яка спрямована на автоматизацію процесів + управління класом, облік даних про учнів, планування та аналіз навчального + процесу. Основна задача інформаційної системи – спростити роботу класного + керівника, забезпечити ефективну організацію документації та взаємодію з + учасниками освітнього процесу. - Для реалізації системи було використано сучасний стек технологій, а саме: Go -- як основна мова програмування для створення серверної логіки, HTMX -- для динамічного оновлення інтерфейсу без використання складних фреймворків, MySQL -- як СУБД для зберігання даних про учнів, їх оцінки та розклад, Neovim -- як середовище для швидкої та ефективної розробки коду, Go Echo -- веб-фреймворк для створення REST API, Go SQLx -- бібліотека для роботи з базою даних, що забезпечує зручність і гнучкість. + Для реалізації системи було використано сучасний стек технологій, а саме: Go -- + як основна мова програмування для створення серверної логіки, HTMX -- для + динамічного оновлення інтерфейсу без використання складних фреймворків, MySQL -- + як СУБД для зберігання даних про учнів, їх оцінки та розклад, Neovim -- як + середовище для швидкої та ефективної розробки коду, Go Echo -- веб-фреймворк для + створення REST API, Go SQLx -- бібліотека для роботи з базою даних, що + забезпечує зручність і гнучкість. - Результат роботи – веб-додаток, який дозволяє обліковувати особисті дані учнів та їхніх опікунів, включаючи інформацію про успішність, відвідуваність та інші показники; планувати розклад занять; генерувати звіти про успішність учнів та переглядати різну статистику. Інтерфейс, створений з використанням HTMX, легко адаптується під потреби користувача. + Результат роботи – веб-додаток, який дозволяє обліковувати особисті дані учнів + та їхніх опікунів, включаючи інформацію про успішність, відвідуваність та інші + показники; планувати розклад занять; генерувати звіти про успішність учнів та + переглядати різну статистику. Інтерфейс, створений з використанням HTMX, легко + адаптується під потреби користувача. ], ) @@ -94,9 +117,8 @@ #show: cw-template.with( title: "Інформаційна система «Помічник класного керівника». Керування класом", - subject_shorthand: "БД", - department_gen: "Програмної інженерії", - edu_program_shorthand: "ПЗПІ", + subject_short: "БД", + edu_program_short: "ПЗПІ", author: author, mentors: mentors, task_list: task_list, diff --git a/template/lab.typ b/template/lab.typ index 604b08a..647af5e 100644 --- a/template/lab.typ +++ b/template/lab.typ @@ -2,9 +2,9 @@ #show: lab-pz-template.with( doctype: "ЛБ", + edu_program_short: "ПЗПІ", title: "Інформаційна система «Помічник класного керівника». Керування класом", - subject_shorthand: "БД", - department_gen: "Програмної інженерії", + subject_short: "БД", authors: ( ( name: "Ситник Є. С.", @@ -14,10 +14,8 @@ gender: "m", ), ), - mentor: ( - name: "Черепанова Ю. Ю.", - gender: "f", - degree: "Ст. викл. каф. ПІ", + mentors: ( + (name: "Черепанова Ю. Ю.", gender: "f", degree: "Ст. викл. каф. ПІ"), ), worknumber: 1, ) From cf10e0fbdc831b3e4364baec50b29a0607760ac9 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 20:42:17 +0200 Subject: [PATCH 04/19] style: format in 120 column width --- lib.typ | 19 +++++-------------- template/coursework.typ | 30 +++++------------------------- 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/lib.typ b/lib.typ index dc50885..4b3775a 100644 --- a/lib.typ +++ b/lib.typ @@ -399,9 +399,7 @@ grid( columns: (1fr, 1fr, 1fr), gutter: 0.3fr, - [#bold[Курс] #uline(2)], - [#bold[Група] #uline(author.group)], - [#bold[Семестр] #uline(3)], + [#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)], ) linebreak() @@ -522,21 +520,17 @@ #{ let keywords = abstract.keywords.map(upper) - let is_cyrillic = word => word - .split("") - .any(char => ("А" <= char and char <= "я")) + let is_cyrillic = word => word.split("").any(char => ("А" <= char and char <= "я")) let n = keywords.len() for i in range(n) { for j in range(0, n - i - 1) { if ( ( - not is_cyrillic(keywords.at(j)) - and is_cyrillic(keywords.at(j + 1)) + not is_cyrillic(keywords.at(j)) and is_cyrillic(keywords.at(j + 1)) ) or ( - is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) - and keywords.at(j) > keywords.at(j + 1) + is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) and keywords.at(j) > keywords.at(j + 1) ) ) { (keywords.at(j), keywords.at(j + 1)) = ( @@ -613,10 +607,7 @@ } context { - for (i, citation) in query(ref.where(element: none)) - .map(r => str(r.target)) - .dedup() - .enumerate() { + for (i, citation) in query(ref.where(element: none)).map(r => str(r.target)).dedup().enumerate() { enum.item( i + 1, format-entry(bib_data.at(citation)), diff --git a/template/coursework.typ b/template/coursework.typ index e3509ce..e32b4c0 100644 --- a/template/coursework.typ +++ b/template/coursework.typ @@ -26,39 +26,19 @@ plan_table: table( columns: 4, align: (center, left, center, center), - [Номер], - [Назва етапів курсової роботи], - [Строк виконання етапів роботи], - [Примітки], - + [Номер], [Назва етапів курсової роботи], [Строк виконання етапів роботи], [Примітки], [1], [Аналіз предметної області], [15.09.24 – 24.09.24], [Виконано], [2], [Концептуальне моделювання], [24.09.24-30.09.24], [~], [2], [Постановка задачі], [28.09.24 – 2.10.24], [Виконано], [3], [Побудова ER-діаграми та схеми БД], [2.10.24 – 18.10.24], [Виконано], - [4], - [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], - [10.10.24 - 18.10.24], - [Виконано], - + [4], [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], [10.10.24 - 18.10.24], [Виконано], [5], [Перша контрольна точка з курсової роботи], [20.10.24], [Виконано], [6], [Нормалізація бази даних], [20.10.24 - 15.11.24], [Виконано], [7], [Створення програми], [20.10.24 – 20.11.24], [Виконано], - [8], - [Тестування програми, наповнення бази даних], - [20.11.24 - 5.12.24], - [Виконано], - + [8], [Тестування програми, наповнення бази даних], [20.11.24 - 5.12.24], [Виконано], [9], [Друга контрольна точка з курсової роботи], [7.12.24], [Виконано], - [10], - [Реалізація остаточної версії програми], - [7.12.24-15.12.24], - [Виконано], - - [11], - [Оформлення інших розділів пояснювальної записки], - [1.11.24 – 25.12.24], - [Виконано], - + [10], [Реалізація остаточної версії програми], [7.12.24-15.12.24], [Виконано], + [11], [Оформлення інших розділів пояснювальної записки], [1.11.24 – 25.12.24], [Виконано], [12], [Третя контрольна точка з курсової роботи], [27.12.24], [Виконано], ), approval_date: datetime(year: 2024, month: 12, day: 27), From 0b8ceda4f1874f236fd154fbfa5b18add1c44cfe Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 23:02:32 +0200 Subject: [PATCH 05/19] 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 --- README.md | 10 +++++++--- lib.typ | 28 +++++++++++++++------------- template/lab.typ | 2 +- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2f33faa..7f4185a 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,16 @@ typst init @local/nure:0.0.0 project-name Include lib.typ in your project and utilize the provided functions: ```typst -// Import the template -#import "lib.typ": * +// Import the template either from a local package... +#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 -#show: lab-pz-template.with( +#show: pz-lb-template.with( title: "Some title", + // etc: "and so on", + // ... ) // this template automatically inserts a `=title` diff --git a/lib.typ b/lib.typ index 4b3775a..7f470b3 100644 --- a/lib.typ +++ b/lib.typ @@ -15,14 +15,16 @@ /// education program abbreviations to name & number #let edu_programs = ( "ПЗПІ": ( + name: "ПЗПІ", // i don't like it + name-long: "Інженерія програмного забезпечення", department_gen: "Програмної інженерії", - name: "Інженерія програмного забезпечення", - number: 121, // TODO: ПЗПІ is "F2" now + code: 121, // TODO: ПЗПІ is "F2" now ), "КУІБ": ( + name: "КУІБ", // i don't like it + name-long: "Управління інформаційною безпекою", department_gen: "Інфокомунікацій", - name: "Управління інформаційною безпекою", - number: 125, + code: 125, ), ) @@ -393,7 +395,7 @@ linebreak() uline(align: left, subjects.at(subject_short)) linebreak() - uline(align: left, [#edu_program.number #edu_program.name]) + uline(align: left, [#edu_program.code #edu_program.name-long]) }, ) grid( @@ -667,16 +669,16 @@ /// - subject_short (str): Subject short name. /// - 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. -/// - mentors (name: str, gender: str or none, degree: str): Mentors objects. -#let lab-pz-template( +/// - mentors ((name: str, degree: str, gender: str or none): Mentors objects. +#let pz-lb-template( doc, - doctype: "NONE", - edu_program_short: "ПЗПІ", - title: "NONE", - subject_short: "NONE", + doctype: none, + edu_program_short: edu_programs.keys().first(), + title: none, + subject_short: none, worknumber: 1, authors: (), - mentors: (gender: none), + mentors: (), ) = { set document(title: title, author: authors.at(0).name) @@ -713,7 +715,7 @@ let author = authors.at(0) if author.gender == "m" [Виконав:\ ] else [Виконала:\ ] [ - ст. гр. #author.edu_program\-#author.group\ + ст. гр. #edu_program.name\-#author.group\ #author.name\ ] if author.variant != none [Варіант: №#author.variant] diff --git a/template/lab.typ b/template/lab.typ index 647af5e..4dabe14 100644 --- a/template/lab.typ +++ b/template/lab.typ @@ -1,6 +1,6 @@ #import "@local/nure:0.0.0": * -#show: lab-pz-template.with( +#show: pz-lb-template.with( doctype: "ЛБ", edu_program_short: "ПЗПІ", title: "Інформаційна система «Помічник класного керівника». Керування класом", From 63dbd82e4d6d66ecd9338a8d25f5371f3bae6771 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 23:15:40 +0200 Subject: [PATCH 06/19] docs(readme): update structure --- README.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7f4185a..2dd2ebe 100644 --- a/README.md +++ b/README.md @@ -64,12 +64,24 @@ Some text ### Example Project Structure ``` -project-folder/ -├── main.typ -├── template.typ -├── images/ -│ ├── figure1.png -│ ├── figure2.png -│ ├── ... -├── ... +project/ +├── main.typ -- for importing, configuration and boilerplate +├── src/ +│ ├── intro.typ +│ ├── chapter1.typ +│ ├── chapter2.typ +│ └── ... +├── figures/ +│ ├── chapter1/ +│ │ ├── figure1.png +│ │ ├── figure2.png +│ │ ├── figure3.png +│ │ └── ... +│ ├── chapter2/ +│ │ ├── figure1.png +│ │ ├── figure2.png +│ │ ├── figure3.png +│ │ └── ... +│ └── ... +└── ... ``` From d60d3a9c89f6b8e8495a139fd9c572578cab3beb Mon Sep 17 00:00:00 2001 From: unexplrd Date: Wed, 12 Mar 2025 23:21:33 +0200 Subject: [PATCH 07/19] misc: change .gitignore to ignore all pdf files --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5787f86..a136337 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -template.pdf +*.pdf From b3214e21502e6ba7c9a76782c5a92127a8ab6437 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 12:12:57 +0200 Subject: [PATCH 08/19] feat!: rename some parametes to avoid redundancy fix: avoid hard-coded defaults docs(readme): add more detail --- README.md | 19 +++++++++++++------ lib.typ | 56 +++++++++++++++++++++++++++---------------------------- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 2dd2ebe..0b04cdc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This project contains two template functions and some utilities for writing NURE #### `pz-lb-template` - For Laboratory and Practical Works This template: - Sets up document styles; -- Formats the title page according to NURE guidelines. +- Formats the title page according to NURE/DSTU guidelines. #### `cw-template` - For Course Works This template: @@ -36,14 +36,15 @@ git clone https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local typst init @local/nure:0.0.0 project-name ``` -### As a file in your project -Include lib.typ in your project and utilize the provided functions: +### As a standalone file +Copy `lib.typ` to your project's root directory. +### In your project ```typst // Import the template either from a local package... #import "@local/nure:0.0.0": * -// ...or by importing a lib.typ directly from a project's root directory -// #import "lib.typ": * +// ...or by importing a lib.typ directly +// #import "/lib.typ": * // Setup the document #show: pz-lb-template.with( @@ -53,10 +54,16 @@ Include lib.typ in your project and utilize the provided functions: ) // this template automatically inserts a `=title` -// Write your content +// Write your content... #v(-spacing) // remove spacing between headings == Purpose Some text + +// ...or include your modules +// NOTE: you have to import a package or a lib.typ in each module. +#include "src/intro.typ" +#include "src/chapter1.typ" +#include "src/chapter2.typ" ``` ### Notes: diff --git a/lib.typ b/lib.typ index 7f470b3..69fa387 100644 --- a/lib.typ +++ b/lib.typ @@ -10,18 +10,17 @@ "ПП": "Проектний практикум", "СПМ": "Скриптові мови програмування", "Ф": "Філософія", + "ФІЗ": "Фізика", ) /// education program abbreviations to name & number #let edu_programs = ( "ПЗПІ": ( - name: "ПЗПІ", // i don't like it name-long: "Інженерія програмного забезпечення", department_gen: "Програмної інженерії", code: 121, // TODO: ПЗПІ is "F2" now ), "КУІБ": ( - name: "КУІБ", // i don't like it name-long: "Управління інформаційною безпекою", department_gen: "Інфокомунікацій", code: 125, @@ -268,10 +267,10 @@ /// -> content /// - doc (content): Content to apply the template to. /// - title (str): Title of the document. -/// - subject_short (str): Subject short name. +/// - subject (str): Subject short name. /// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts. /// - mentors ((name: str, gender: str, degree: str),): List of mentors dicts. -/// - edu_program_short (str): Education program shorthand. +/// - edu_program (str): Education program shorthand. /// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object. /// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object. /// - abstract (keywords: (str, ), text: (content | str)): Abstract object. @@ -279,11 +278,11 @@ /// - appendices (content): Content with appendices. #let cw-template( doc, - title: "NONE", - subject_short: "NONE", + title: none, + subject: none, author: (), mentors: (), - edu_program_short: "ПЗПІ", + edu_program: none, task_list: (), calendar_plan: (), abstract: (), @@ -306,7 +305,7 @@ let head_mentor = mentors.at(0) - let edu_program = edu_programs.at(edu_program_short) + let edu_prog = edu_programs.at(edu_program) // page 1 {{{2 [ @@ -317,7 +316,7 @@ \ - Кафедра Програмної інженерії + Кафедра #edu_prog.department_gen \ @@ -325,7 +324,7 @@ ДО КУРСОВОЇ РОБОТИ - з дисципліни: "#subjects.at(subject_short, default: "NONE")" + з дисципліни: "#subjects.at(subject, default: "NONE")" Тема роботи: "#title" @@ -391,11 +390,11 @@ Спеціальність ], { - uline(align: left, edu_program.department_gen) + uline(align: left, edu_prog.department_gen) linebreak() - uline(align: left, subjects.at(subject_short)) + uline(align: left, subjects.at(subject)) linebreak() - uline(align: left, [#edu_program.code #edu_program.name-long]) + uline(align: left, [#edu_prog.code #edu_prog.name-long]) }, ) grid( @@ -664,19 +663,19 @@ /// -> content /// - doc (content): Content to apply the template to. /// - doctype ("ЛБ" | "ПЗ"): Document type. -/// - edu_program_short (str): Education program shorthand. +/// - edu_program (str): Education program shorthand. /// - title (str): Title of the document. -/// - subject_short (str): Subject short name. -/// - 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. -/// - mentors ((name: str, degree: str, gender: str or none): Mentors objects. +/// - subject (str): Subject shorthand. +/// - authors ((name: str, full_name_gen: str, group: str, gender: str, variant: int or none),): List of authors. +/// - mentors ((name: str, degree: str, gender: str or none),): List of mentors. +/// - worknumber (int or none): Number of the work. Optional. #let pz-lb-template( doc, doctype: none, - edu_program_short: edu_programs.keys().first(), + edu_program: none, title: none, - subject_short: none, - worknumber: 1, + subject: none, + worknumber: none, authors: (), mentors: (), ) = { @@ -684,25 +683,24 @@ show: style - let edu_program = edu_programs.at(edu_program_short) - - context counter(heading).update(worknumber - 1) - // page 1 {{{2 align(center)[ МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \ ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ \ \ - Кафедра #edu_program.department_gen + Кафедра #edu_programs.at(edu_program).department_gen \ \ \ Звіт \ з #if doctype == "ЛБ" [лабораторної роботи] else [практичної роботи] - #if worknumber != none [№ #worknumber] + #if worknumber != none { + context counter(heading).update(worknumber - 1) + [№#worknumber] + } - з дисципліни: "#subjects.at(subject_short, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")" + з дисципліни: "#subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")" з теми: "#title" @@ -715,7 +713,7 @@ let author = authors.at(0) if author.gender == "m" [Виконав:\ ] else [Виконала:\ ] [ - ст. гр. #edu_program.name\-#author.group\ + ст. гр. #edu_program\-#author.group\ #author.name\ ] if author.variant != none [Варіант: №#author.variant] From 429f632841c96a585413dc791df214913aa738f8 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 12:35:12 +0200 Subject: [PATCH 09/19] fix!: remove unnecessary gender key in cw_template fix: add more subjects docs: unify comments with pz_lb_template --- lib.typ | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib.typ b/lib.typ index 69fa387..b6b886e 100644 --- a/lib.typ +++ b/lib.typ @@ -4,11 +4,14 @@ /// subject abbreviations to full names #let subjects = ( "БД": "Бази даних", - "ОТК": "Основи теорії кіл", + "БЖД": "Безпека життєдіяльності", + "ОІМ": "Основи IP-мереж", "ОПНJ": "Основи програмування на Java", "ОС": "Операційні системи", + "ОТК": "Основи теорії кіл", "ПП": "Проектний практикум", "СПМ": "Скриптові мови програмування", + "УФМ": "Українське фахове мовлення", "Ф": "Філософія", "ФІЗ": "Фізика", ) @@ -268,8 +271,8 @@ /// - doc (content): Content to apply the template to. /// - title (str): Title of the document. /// - subject (str): Subject short name. -/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts. -/// - mentors ((name: str, gender: str, degree: str),): List of mentors dicts. +/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of authors. +/// - mentors ((name: str, degree: str),): List of mentors. /// - edu_program (str): Education program shorthand. /// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object. /// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object. @@ -400,7 +403,9 @@ grid( columns: (1fr, 1fr, 1fr), gutter: 0.3fr, - [#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)], + [#bold[Курс] #uline(2)], + [#bold[Група] #uline(author.group)], + [#bold[Семестр] #uline(3)], ) linebreak() @@ -521,17 +526,21 @@ #{ let keywords = abstract.keywords.map(upper) - let is_cyrillic = word => word.split("").any(char => ("А" <= char and char <= "я")) + let is_cyrillic = word => word + .split("") + .any(char => ("А" <= char and char <= "я")) let n = keywords.len() for i in range(n) { for j in range(0, n - i - 1) { if ( ( - not is_cyrillic(keywords.at(j)) and is_cyrillic(keywords.at(j + 1)) + not is_cyrillic(keywords.at(j)) + and is_cyrillic(keywords.at(j + 1)) ) or ( - is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) and keywords.at(j) > keywords.at(j + 1) + is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) + and keywords.at(j) > keywords.at(j + 1) ) ) { (keywords.at(j), keywords.at(j + 1)) = ( @@ -608,7 +617,10 @@ } context { - for (i, citation) in query(ref.where(element: none)).map(r => str(r.target)).dedup().enumerate() { + for (i, citation) in query(ref.where(element: none)) + .map(r => str(r.target)) + .dedup() + .enumerate() { enum.item( i + 1, format-entry(bib_data.at(citation)), From 41dcbeb1ec8299c9d832805e0ef482f1972516d6 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 12:37:58 +0200 Subject: [PATCH 10/19] feat!: bump version to 0.1.0 fix: adjust templates style: reformat lib.typ w/ 120 column width --- README.md | 6 +++--- lib.typ | 19 +++++-------------- template/coursework.typ | 6 +++--- template/lab.typ | 10 +++++----- typst.toml | 2 +- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 0b04cdc..137d0af 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,11 @@ This template: ### As a local typst package 1. Clone this repository into ~/.local/share/typst/packages/: ```bash -git clone https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.0.0 +git clone https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.1.0 ``` 2. Init your project with Typst: ```bash -typst init @local/nure:0.0.0 project-name +typst init @local/nure:0.1.0 project-name ``` ### As a standalone file @@ -42,7 +42,7 @@ Copy `lib.typ` to your project's root directory. ### In your project ```typst // Import the template either from a local package... -#import "@local/nure:0.0.0": * +#import "@local/nure:0.1.0": * // ...or by importing a lib.typ directly // #import "/lib.typ": * diff --git a/lib.typ b/lib.typ index b6b886e..19eb311 100644 --- a/lib.typ +++ b/lib.typ @@ -403,9 +403,7 @@ grid( columns: (1fr, 1fr, 1fr), gutter: 0.3fr, - [#bold[Курс] #uline(2)], - [#bold[Група] #uline(author.group)], - [#bold[Семестр] #uline(3)], + [#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)], ) linebreak() @@ -526,21 +524,17 @@ #{ let keywords = abstract.keywords.map(upper) - let is_cyrillic = word => word - .split("") - .any(char => ("А" <= char and char <= "я")) + let is_cyrillic = word => word.split("").any(char => ("А" <= char and char <= "я")) let n = keywords.len() for i in range(n) { for j in range(0, n - i - 1) { if ( ( - not is_cyrillic(keywords.at(j)) - and is_cyrillic(keywords.at(j + 1)) + not is_cyrillic(keywords.at(j)) and is_cyrillic(keywords.at(j + 1)) ) or ( - is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) - and keywords.at(j) > keywords.at(j + 1) + is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) and keywords.at(j) > keywords.at(j + 1) ) ) { (keywords.at(j), keywords.at(j + 1)) = ( @@ -617,10 +611,7 @@ } context { - for (i, citation) in query(ref.where(element: none)) - .map(r => str(r.target)) - .dedup() - .enumerate() { + for (i, citation) in query(ref.where(element: none)).map(r => str(r.target)).dedup().enumerate() { enum.item( i + 1, format-entry(bib_data.at(citation)), diff --git a/template/coursework.typ b/template/coursework.typ index e32b4c0..b18949f 100644 --- a/template/coursework.typ +++ b/template/coursework.typ @@ -9,9 +9,9 @@ ) #let mentors = ( - (name: "Черепанова Ю. Ю.", gender: "f", degree: "Ст. викл. каф. ПІ"), - (name: "Русакова Н. Є.", gender: "f", degree: "Доц. каф. ПІ"), - (name: "Широкопетлєва М. С.", gender: "f", degree: "Ст. викл. каф. ПІ"), + (name: "Черепанова Ю. Ю.", degree: "Ст. викл. каф. ПІ"), + (name: "Русакова Н. Є.", degree: "Доц. каф. ПІ"), + (name: "Широкопетлєва М. С.", degree: "Ст. викл. каф. ПІ"), ) #let task_list = ( diff --git a/template/lab.typ b/template/lab.typ index 4dabe14..4268ae1 100644 --- a/template/lab.typ +++ b/template/lab.typ @@ -1,10 +1,11 @@ -#import "@local/nure:0.0.0": * +#import "@local/nure:0.1.0": * #show: pz-lb-template.with( doctype: "ЛБ", - edu_program_short: "ПЗПІ", + edu_program: "ПЗПІ", + subject: "БД", + worknumber: 1, title: "Інформаційна система «Помічник класного керівника». Керування класом", - subject_short: "БД", authors: ( ( name: "Ситник Є. С.", @@ -15,9 +16,8 @@ ), ), mentors: ( - (name: "Черепанова Ю. Ю.", gender: "f", degree: "Ст. викл. каф. ПІ"), + (name: "Черепанова Ю. Ю.", degree: "Ст. викл. каф. ПІ", gender: "f"), ), - worknumber: 1, ) #v(-spacing) diff --git a/typst.toml b/typst.toml index de71a78..c09a9d5 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name = "nure" -version = "0.0.0" +version = "0.1.0" entrypoint = "lib.typ" authors = ["linerds"] license = "GPL-3.0" From 1db499dad481c8dce6c706f2d0f99f4edac4780e Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 12:42:14 +0200 Subject: [PATCH 11/19] docs(readme): change repo owner --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 137d0af..d1e3972 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This template: ### As a local typst package 1. Clone this repository into ~/.local/share/typst/packages/: ```bash -git clone https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.1.0 +git clone https://gitea.linerds.us/unexplrd/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.1.0 ``` 2. Init your project with Typst: ```bash From 22fb1de73677d771dca5ccfb5540db3fae0a520c Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 12:56:18 +0200 Subject: [PATCH 12/19] docs: fix --- README.md | 2 +- template/coursework.typ | 32 ++++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d1e3972..134ed09 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This template: ### As a local typst package 1. Clone this repository into ~/.local/share/typst/packages/: ```bash -git clone https://gitea.linerds.us/unexplrd/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.1.0 +git clone -b 0.1.0 https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.1.0 ``` 2. Init your project with Typst: ```bash diff --git a/template/coursework.typ b/template/coursework.typ index b18949f..96e835e 100644 --- a/template/coursework.typ +++ b/template/coursework.typ @@ -1,4 +1,4 @@ -#import "@local/nure:0.0.0": * +#import "@local/nure:0.1.0": * #let author = ( name: "Ситник Є. С.", @@ -26,19 +26,39 @@ plan_table: table( columns: 4, align: (center, left, center, center), - [Номер], [Назва етапів курсової роботи], [Строк виконання етапів роботи], [Примітки], + [Номер], + [Назва етапів курсової роботи], + [Строк виконання етапів роботи], + [Примітки], + [1], [Аналіз предметної області], [15.09.24 – 24.09.24], [Виконано], [2], [Концептуальне моделювання], [24.09.24-30.09.24], [~], [2], [Постановка задачі], [28.09.24 – 2.10.24], [Виконано], [3], [Побудова ER-діаграми та схеми БД], [2.10.24 – 18.10.24], [Виконано], - [4], [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], [10.10.24 - 18.10.24], [Виконано], + [4], + [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], + [10.10.24 - 18.10.24], + [Виконано], + [5], [Перша контрольна точка з курсової роботи], [20.10.24], [Виконано], [6], [Нормалізація бази даних], [20.10.24 - 15.11.24], [Виконано], [7], [Створення програми], [20.10.24 – 20.11.24], [Виконано], - [8], [Тестування програми, наповнення бази даних], [20.11.24 - 5.12.24], [Виконано], + [8], + [Тестування програми, наповнення бази даних], + [20.11.24 - 5.12.24], + [Виконано], + [9], [Друга контрольна точка з курсової роботи], [7.12.24], [Виконано], - [10], [Реалізація остаточної версії програми], [7.12.24-15.12.24], [Виконано], - [11], [Оформлення інших розділів пояснювальної записки], [1.11.24 – 25.12.24], [Виконано], + [10], + [Реалізація остаточної версії програми], + [7.12.24-15.12.24], + [Виконано], + + [11], + [Оформлення інших розділів пояснювальної записки], + [1.11.24 – 25.12.24], + [Виконано], + [12], [Третя контрольна точка з курсової роботи], [27.12.24], [Виконано], ), approval_date: datetime(year: 2024, month: 12, day: 27), From c049a9a3ce59052d5a50736979fdaca0d982043c Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 13:08:18 +0200 Subject: [PATCH 13/19] style: reformat with 120 col width --- template/coursework.typ | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/template/coursework.typ b/template/coursework.typ index 96e835e..a0e2570 100644 --- a/template/coursework.typ +++ b/template/coursework.typ @@ -26,39 +26,19 @@ plan_table: table( columns: 4, align: (center, left, center, center), - [Номер], - [Назва етапів курсової роботи], - [Строк виконання етапів роботи], - [Примітки], - + [Номер], [Назва етапів курсової роботи], [Строк виконання етапів роботи], [Примітки], [1], [Аналіз предметної області], [15.09.24 – 24.09.24], [Виконано], [2], [Концептуальне моделювання], [24.09.24-30.09.24], [~], [2], [Постановка задачі], [28.09.24 – 2.10.24], [Виконано], [3], [Побудова ER-діаграми та схеми БД], [2.10.24 – 18.10.24], [Виконано], - [4], - [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], - [10.10.24 - 18.10.24], - [Виконано], - + [4], [Оформлення розділів 1, 2 та 3.1, 3.2 пояснювальної записки], [10.10.24 - 18.10.24], [Виконано], [5], [Перша контрольна точка з курсової роботи], [20.10.24], [Виконано], [6], [Нормалізація бази даних], [20.10.24 - 15.11.24], [Виконано], [7], [Створення програми], [20.10.24 – 20.11.24], [Виконано], - [8], - [Тестування програми, наповнення бази даних], - [20.11.24 - 5.12.24], - [Виконано], - + [8], [Тестування програми, наповнення бази даних], [20.11.24 - 5.12.24], [Виконано], [9], [Друга контрольна точка з курсової роботи], [7.12.24], [Виконано], - [10], - [Реалізація остаточної версії програми], - [7.12.24-15.12.24], - [Виконано], - - [11], - [Оформлення інших розділів пояснювальної записки], - [1.11.24 – 25.12.24], - [Виконано], - + [10], [Реалізація остаточної версії програми], [7.12.24-15.12.24], [Виконано], + [11], [Оформлення інших розділів пояснювальної записки], [1.11.24 – 25.12.24], [Виконано], [12], [Третя контрольна точка з курсової роботи], [27.12.24], [Виконано], ), approval_date: datetime(year: 2024, month: 12, day: 27), From bf00b3de5d9d5335f14b3b5e5d03211145a79ac0 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 16:52:52 +0200 Subject: [PATCH 14/19] feat!: add course and semester keys for authors fix: bring cw-template more in line with pz-lb-template fix: remove hard-coded values docs: update a template --- lib.typ | 31 +++++++++++++++++-------------- template/coursework.typ | 2 ++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lib.typ b/lib.typ index 19eb311..95aa9c2 100644 --- a/lib.typ +++ b/lib.typ @@ -10,6 +10,7 @@ "ОС": "Операційні системи", "ОТК": "Основи теорії кіл", "ПП": "Проектний практикум", + "ПРОГ": "Програмування", "СПМ": "Скриптові мови програмування", "УФМ": "Українське фахове мовлення", "Ф": "Філософія", @@ -254,7 +255,11 @@ spacing: new_spacing, leading: new_spacing, ) - set text(size: 11pt, font: "Courier New", weight: "semibold") + set text( + size: 11pt, + font: "Courier New", + weight: "semibold", + ) v(spacing * 2.5, weak: true) pad(it, left: 1.25cm) @@ -271,7 +276,7 @@ /// - doc (content): Content to apply the template to. /// - title (str): Title of the document. /// - subject (str): Subject short name. -/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of authors. +/// - authors ((name: str, full_name_gen: str, variant: int, course: int, semester: int, group: str, gender: str),): List of authors. /// - mentors ((name: str, degree: str),): List of mentors. /// - edu_program (str): Education program shorthand. /// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object. @@ -289,7 +294,7 @@ task_list: (), calendar_plan: (), abstract: (), - bib_path: "bibl.yml", + bib_path: none, appendices: (), ) = { set document(title: title, author: author.name) @@ -313,8 +318,7 @@ // page 1 {{{2 [ #set align(center) - МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ - + МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ\ ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ \ @@ -323,12 +327,9 @@ \ - ПОЯСНЮВАЛЬНА ЗАПИСКА - - ДО КУРСОВОЇ РОБОТИ - - з дисципліни: "#subjects.at(subject, default: "NONE")" - + ПОЯСНЮВАЛЬНА ЗАПИСКА\ + ДО КУРСОВОЇ РОБОТИ\ + з дисципліни: "#subjects.at(subject, default: "NONE")"\ Тема роботи: "#title" \ \ \ @@ -336,7 +337,7 @@ #columns(2, gutter: 4cm)[ #set align(left) - #if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #author.group + #if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #edu_program\-#author.group \ Керівник:\ @@ -403,7 +404,9 @@ grid( columns: (1fr, 1fr, 1fr), gutter: 0.3fr, - [#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)], + [#bold[Курс] #uline(author.course)], + [#bold[Група] #uline([#edu_program\-#author.group])], + [#bold[Семестр] #uline(author.semester)], ) linebreak() @@ -490,7 +493,7 @@ [ #author.name, \ #head_mentor.degree - #head_mentor.name. + #head_mentor.name ], ) diff --git a/template/coursework.typ b/template/coursework.typ index a0e2570..75b80f1 100644 --- a/template/coursework.typ +++ b/template/coursework.typ @@ -3,6 +3,8 @@ #let author = ( name: "Ситник Є. С.", full_name_gen: "Ситника Єгора Сергійовича", + course: 2, + semester: 3, variant: 13, group: "23-2", gender: "m", From 6bf37099b4822a9c7e9086a17ea0690901ac36d2 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 17:31:22 +0200 Subject: [PATCH 15/19] refactor: move university name into a variable --- lib.typ | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib.typ b/lib.typ index 95aa9c2..7abd8ca 100644 --- a/lib.typ +++ b/lib.typ @@ -1,6 +1,9 @@ // Academic aliases {{{1 +#let universities = ( + "ХНУРЕ": "Харківський національний університет радіоелектроніки", +) /// subject abbreviations to full names #let subjects = ( "БД": "Бази даних", @@ -288,6 +291,7 @@ doc, title: none, subject: none, + university: "ХНУРЕ", author: (), mentors: (), edu_program: none, @@ -314,12 +318,13 @@ let head_mentor = mentors.at(0) let edu_prog = edu_programs.at(edu_program) + let uni = universities.at(university) // page 1 {{{2 [ #set align(center) МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ\ - ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ + #upper(uni) \ @@ -381,7 +386,7 @@ // page 2 {{{2 { - uline[Харківський національний університет радіоелектроніки] + uline[#uni] linebreak() linebreak() @@ -493,7 +498,7 @@ [ #author.name, \ #head_mentor.degree - #head_mentor.name + #head_mentor.name. ], ) @@ -678,6 +683,7 @@ #let pz-lb-template( doc, doctype: none, + university: "ХНУРЕ", edu_program: none, title: none, subject: none, @@ -689,10 +695,11 @@ show: style + let uni = universities.at(university) // page 1 {{{2 align(center)[ МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \ - ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ + #upper(uni) \ \ Кафедра #edu_programs.at(edu_program).department_gen From dc3358d98605694312bb15ab1299b0bb977b5c5a Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 17:57:46 +0200 Subject: [PATCH 16/19] WIP: feat!: move university-related info to yaml file --- lib.typ | 45 +++++++-------------------------------------- universities.yaml | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 38 deletions(-) create mode 100644 universities.yaml diff --git a/lib.typ b/lib.typ index 7abd8ca..509d0f4 100644 --- a/lib.typ +++ b/lib.typ @@ -1,38 +1,7 @@ // Academic aliases {{{1 -#let universities = ( - "ХНУРЕ": "Харківський національний університет радіоелектроніки", -) -/// subject abbreviations to full names -#let subjects = ( - "БД": "Бази даних", - "БЖД": "Безпека життєдіяльності", - "ОІМ": "Основи IP-мереж", - "ОПНJ": "Основи програмування на Java", - "ОС": "Операційні системи", - "ОТК": "Основи теорії кіл", - "ПП": "Проектний практикум", - "ПРОГ": "Програмування", - "СПМ": "Скриптові мови програмування", - "УФМ": "Українське фахове мовлення", - "Ф": "Філософія", - "ФІЗ": "Фізика", -) - -/// education program abbreviations to name & number -#let edu_programs = ( - "ПЗПІ": ( - name-long: "Інженерія програмного забезпечення", - department_gen: "Програмної інженерії", - code: 121, // TODO: ПЗПІ is "F2" now - ), - "КУІБ": ( - name-long: "Управління інформаційною безпекою", - department_gen: "Інфокомунікацій", - code: 125, - ), -) +#let universities = yaml("universities.yaml") // Template formatting functions {{{1 @@ -260,7 +229,7 @@ ) set text( size: 11pt, - font: "Courier New", + font: ("Iosevka NFM", "Courier New"), weight: "semibold", ) @@ -317,8 +286,8 @@ let head_mentor = mentors.at(0) - let edu_prog = edu_programs.at(edu_program) - let uni = universities.at(university) + let edu_prog = universities.at(university).edu_programs.at(edu_program) + let uni = universities.at(university).name // page 1 {{{2 [ @@ -334,7 +303,7 @@ ПОЯСНЮВАЛЬНА ЗАПИСКА\ ДО КУРСОВОЇ РОБОТИ\ - з дисципліни: "#subjects.at(subject, default: "NONE")"\ + з дисципліни: "#universities.at(university).subjects.at(subject, default: "NONE")"\ Тема роботи: "#title" \ \ \ @@ -401,9 +370,9 @@ { uline(align: left, edu_prog.department_gen) linebreak() - uline(align: left, subjects.at(subject)) + uline(align: left, universities.at(university).subjects.at(subject)) linebreak() - uline(align: left, [#edu_prog.code #edu_prog.name-long]) + uline(align: left, [#edu_prog.code #edu_prog.name_long]) }, ) grid( diff --git a/universities.yaml b/universities.yaml new file mode 100644 index 0000000..e21c999 --- /dev/null +++ b/universities.yaml @@ -0,0 +1,24 @@ +ХНУРЕ: + name: "Харківський національний університет радіоелектроніки" + edu_programs: + ПЗПІ: + name_long: "Інженерія програмного забезпечення" + department_gen: "Програмної інженерії" + code: 121 # TODO = ПЗПІ is "F2" now + КУІБ: + name_long: "Управління інформаційною безпекою" + department_gen: "Інфокомунікацій" + code: 125 + subjects: + БД: "Бази даних" + БЖД: "Безпека життєдіяльності" + ОІМ: "Основи IP-мереж" + "ОПНJ": "Основи програмування на Java" + ОС: "Операційні системи" + ОТК: "Основи теорії кіл" + ПП: "Проектний практикум" + ПРОГ: "Програмування" + СПМ: "Скриптові мови програмування" + УФМ: "Українське фахове мовлення" + Ф: "Філософія" + ФІЗ: "Фізика" From c1ad952c7c8c5b0413ea3697dc3213789e93f0b6 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 13 Mar 2025 18:28:39 +0200 Subject: [PATCH 17/19] fix: fix values and refactor, move yaml to config/ --- universities.yaml => config/universities.yaml | 0 lib.typ | 21 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) rename universities.yaml => config/universities.yaml (100%) diff --git a/universities.yaml b/config/universities.yaml similarity index 100% rename from universities.yaml rename to config/universities.yaml diff --git a/lib.typ b/lib.typ index 509d0f4..09f62a5 100644 --- a/lib.typ +++ b/lib.typ @@ -1,7 +1,7 @@ // Academic aliases {{{1 -#let universities = yaml("universities.yaml") +#let universities = yaml("config/universities.yaml") // Template formatting functions {{{1 @@ -286,14 +286,14 @@ let head_mentor = mentors.at(0) - let edu_prog = universities.at(university).edu_programs.at(edu_program) - let uni = universities.at(university).name + let uni = universities.at(university) + let edu_prog = uni.edu_programs.at(edu_program) // page 1 {{{2 [ #set align(center) МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ\ - #upper(uni) + #upper(uni.name) \ @@ -303,7 +303,7 @@ ПОЯСНЮВАЛЬНА ЗАПИСКА\ ДО КУРСОВОЇ РОБОТИ\ - з дисципліни: "#universities.at(university).subjects.at(subject, default: "NONE")"\ + з дисципліни: "#uni.subjects.at(subject, default: "NONE")"\ Тема роботи: "#title" \ \ \ @@ -355,7 +355,7 @@ // page 2 {{{2 { - uline[#uni] + uline[#uni.name] linebreak() linebreak() @@ -370,7 +370,7 @@ { uline(align: left, edu_prog.department_gen) linebreak() - uline(align: left, universities.at(university).subjects.at(subject)) + uline(align: left, uni.subjects.at(subject)) linebreak() uline(align: left, [#edu_prog.code #edu_prog.name_long]) }, @@ -665,13 +665,14 @@ show: style let uni = universities.at(university) + let edu_prog = uni.edu_programs.at(edu_program) // page 1 {{{2 align(center)[ МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \ - #upper(uni) + #upper(uni.name) \ \ - Кафедра #edu_programs.at(edu_program).department_gen + Кафедра #edu_prog.department_gen \ \ \ Звіт \ @@ -682,7 +683,7 @@ [№#worknumber] } - з дисципліни: "#subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")" + з дисципліни: "#uni.subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")" з теми: "#title" From 5bc79a196e92d2ca17a09d03f56fecf64b257805 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Fri, 14 Mar 2025 17:59:18 +0200 Subject: [PATCH 18/19] WIP: introduce yaml config examples in a template --- README.md | 9 +++++++-- template/config/doc.yaml | 22 ++++++++++++++++++++++ template/lab.typ | 20 +------------------- 3 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 template/config/doc.yaml diff --git a/README.md b/README.md index 134ed09..449893d 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,11 @@ Copy `lib.typ` to your project's root directory. Some text // ...or include your modules -// NOTE: you have to import a package or a lib.typ in each module. #include "src/intro.typ" #include "src/chapter1.typ" #include "src/chapter2.typ" +// NOTE: if you want to use variables or utils provided by the package, +// you have to import the package or a lib.typ inside a module. ``` ### Notes: @@ -72,7 +73,11 @@ Some text ### Example Project Structure ``` project/ -├── main.typ -- for importing, configuration and boilerplate +├── main.typ -- for boilerplate code and importing everything +├── config/ +│ ├── doc.yaml -- for things that don't change across works, i.e. author and mentor metadata +│ ├── universities.yaml -- for user-specific configuration, i.e. education programs and disciplines +│ └── ... ├── src/ │ ├── intro.typ │ ├── chapter1.typ diff --git a/template/config/doc.yaml b/template/config/doc.yaml new file mode 100644 index 0000000..aced88f --- /dev/null +++ b/template/config/doc.yaml @@ -0,0 +1,22 @@ +title: Потiк керування та алгоритмічні структури Bash +subject: СПМ +doctype: ЛБ +worknumber: 2 +edu_program: &EDU ПЗПІ +university: ХНУРЕ +authors: + - name: Косач. Л. П. + full_name_gen: Косач Лариси Петрівни + course: 2 + edu: *EDU + gender: f + group: 23-2 + semester: 4 + variant: 8 +mentors: + - name: Шевченко Т. Г. + degree: Доцент кафедри ПІ + gender: m + - name: Франко І. Я. + degree: Асистент кафедри ПІ + gender: m diff --git a/template/lab.typ b/template/lab.typ index 4268ae1..f5bd94e 100644 --- a/template/lab.typ +++ b/template/lab.typ @@ -1,24 +1,6 @@ #import "@local/nure:0.1.0": * -#show: pz-lb-template.with( - doctype: "ЛБ", - edu_program: "ПЗПІ", - subject: "БД", - worknumber: 1, - title: "Інформаційна система «Помічник класного керівника». Керування класом", - authors: ( - ( - name: "Ситник Є. С.", - full_name_gen: "Ситника Єгора Сергійовича", - variant: 13, - group: "ПЗПІ-23-2", - gender: "m", - ), - ), - mentors: ( - (name: "Черепанова Ю. Ю.", degree: "Ст. викл. каф. ПІ", gender: "f"), - ), -) +#show: pz-lb-template.with(..yaml("config/doc.yaml")) #v(-spacing) From 5be6cea4fb3a8154abe00adf0dea11cbe86c3b78 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Sat, 15 Mar 2025 16:36:16 +0200 Subject: [PATCH 19/19] fix: fix multiple authors docs(config): adjust and fix typo --- lib.typ | 9 ++++++--- template/config/doc.yaml | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib.typ b/lib.typ index 09f62a5..b51c4ac 100644 --- a/lib.typ +++ b/lib.typ @@ -73,7 +73,10 @@ [#caption (за даними #sink.pos().first())] } - [#figure(image(path, ..sink.named()), caption: caption) #label(label_string)] + [#figure( + image(path, ..sink.named()), + caption: caption, + ) #label(label_string)] } // Styling {{{1 @@ -702,8 +705,8 @@ if author.variant != none [Варіант: №#author.variant] } else [ Виконали:\ - ст. гр. #authors.at(0).group\ - #authors.map(a => [ #a.name\ ]) + ст. гр. #edu_program\-#authors.at(0).group\ + #for author in authors [#author.name\ ] ] #colbreak() diff --git a/template/config/doc.yaml b/template/config/doc.yaml index aced88f..1e6f7d5 100644 --- a/template/config/doc.yaml +++ b/template/config/doc.yaml @@ -2,17 +2,6 @@ title: Потiк керування та алгоритмічні структу subject: СПМ doctype: ЛБ worknumber: 2 -edu_program: &EDU ПЗПІ -university: ХНУРЕ -authors: - - name: Косач. Л. П. - full_name_gen: Косач Лариси Петрівни - course: 2 - edu: *EDU - gender: f - group: 23-2 - semester: 4 - variant: 8 mentors: - name: Шевченко Т. Г. degree: Доцент кафедри ПІ @@ -20,3 +9,14 @@ mentors: - name: Франко І. Я. degree: Асистент кафедри ПІ gender: m +edu_program: &EDU ПЗПІ +university: ХНУРЕ +authors: + - name: Косач Л. П. + full_name_gen: Косач Лариси Петрівни + course: 2 + edu: *EDU + gender: f + group: 23-2 + semester: 4 + variant: 8