9 Commits

Author SHA1 Message Date
5be6cea4fb fix: fix multiple authors
docs(config): adjust and fix typo
2025-03-15 16:36:16 +02:00
5bc79a196e WIP: introduce yaml config examples in a template 2025-03-14 17:59:18 +02:00
c1ad952c7c fix: fix values and refactor, move yaml to config/ 2025-03-13 18:28:39 +02:00
dc3358d986 WIP: feat!: move university-related info to yaml file 2025-03-13 17:57:46 +02:00
6bf37099b4 refactor: move university name into a variable 2025-03-13 17:31:22 +02:00
bf00b3de5d 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
2025-03-13 16:52:52 +02:00
c049a9a3ce style: reformat with 120 col width 2025-03-13 13:08:18 +02:00
22fb1de736 docs: fix 2025-03-13 12:56:18 +02:00
1db499dad4 docs(readme): change repo owner 2025-03-13 12:42:14 +02:00
6 changed files with 93 additions and 75 deletions

View File

@ -29,7 +29,7 @@ This template:
### As a local typst package ### As a local typst package
1. Clone this repository into ~/.local/share/typst/packages/: 1. Clone this repository into ~/.local/share/typst/packages/:
```bash ```bash
git clone https://gitea.linerds.us/pencelheimer/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: 2. Init your project with Typst:
```bash ```bash
@ -60,10 +60,11 @@ Copy `lib.typ` to your project's root directory.
Some text Some text
// ...or include your modules // ...or include your modules
// NOTE: you have to import a package or a lib.typ in each module.
#include "src/intro.typ" #include "src/intro.typ"
#include "src/chapter1.typ" #include "src/chapter1.typ"
#include "src/chapter2.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: ### Notes:
@ -72,7 +73,11 @@ Some text
### Example Project Structure ### Example Project Structure
``` ```
project/ 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/ ├── src/
│ ├── intro.typ │ ├── intro.typ
│ ├── chapter1.typ │ ├── chapter1.typ

24
config/universities.yaml Normal file
View File

@ -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"
ОС: "Операційні системи"
ОТК: "Основи теорії кіл"
ПП: "Проектний практикум"
ПРОГ: "Програмування"
СПМ: "Скриптові мови програмування"
УФМ: "Українське фахове мовлення"
Ф: "Філософія"
ФІЗ: "Фізика"

87
lib.typ
View File

@ -1,34 +1,7 @@
// Academic aliases {{{1 // Academic aliases {{{1
/// subject abbreviations to full names #let universities = yaml("config/universities.yaml")
#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,
),
)
// Template formatting functions {{{1 // Template formatting functions {{{1
@ -100,7 +73,10 @@
[#caption (за даними #sink.pos().first())] [#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 // Styling {{{1
@ -254,7 +230,11 @@
spacing: new_spacing, spacing: new_spacing,
leading: new_spacing, leading: new_spacing,
) )
set text(size: 11pt, font: "Courier New", weight: "semibold") set text(
size: 11pt,
font: ("Iosevka NFM", "Courier New"),
weight: "semibold",
)
v(spacing * 2.5, weak: true) v(spacing * 2.5, weak: true)
pad(it, left: 1.25cm) pad(it, left: 1.25cm)
@ -271,7 +251,7 @@
/// - doc (content): Content to apply the template to. /// - doc (content): Content to apply the template to.
/// - title (str): Title of the document. /// - title (str): Title of the document.
/// - subject (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. /// - 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. /// - mentors ((name: str, degree: str),): List of mentors.
/// - edu_program (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. /// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object.
@ -283,13 +263,14 @@
doc, doc,
title: none, title: none,
subject: none, subject: none,
university: "ХНУРЕ",
author: (), author: (),
mentors: (), mentors: (),
edu_program: none, edu_program: none,
task_list: (), task_list: (),
calendar_plan: (), calendar_plan: (),
abstract: (), abstract: (),
bib_path: "bibl.yml", bib_path: none,
appendices: (), appendices: (),
) = { ) = {
set document(title: title, author: author.name) set document(title: title, author: author.name)
@ -308,14 +289,14 @@
let head_mentor = mentors.at(0) let head_mentor = mentors.at(0)
let edu_prog = edu_programs.at(edu_program) let uni = universities.at(university)
let edu_prog = uni.edu_programs.at(edu_program)
// page 1 {{{2 // page 1 {{{2
[ [
#set align(center) #set align(center)
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ\
#upper(uni.name)
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
\ \
@ -323,12 +304,9 @@
\ \
ПОЯСНЮВАЛЬНА ЗАПИСКА ПОЯСНЮВАЛЬНА ЗАПИСКА\
ДО КУРСОВОЇ РОБОТИ\
ДО КУРСОВОЇ РОБОТИ з дисципліни: "#uni.subjects.at(subject, default: "NONE")"\
з дисципліни: "#subjects.at(subject, default: "NONE")"
Тема роботи: "#title" Тема роботи: "#title"
\ \ \ \ \ \
@ -336,7 +314,7 @@
#columns(2, gutter: 4cm)[ #columns(2, gutter: 4cm)[
#set align(left) #set align(left)
#if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #author.group #if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #edu_program\-#author.group
\ \
Керівник:\ Керівник:\
@ -380,7 +358,7 @@
// page 2 {{{2 // page 2 {{{2
{ {
uline[Харківський національний університет радіоелектроніки] uline[#uni.name]
linebreak() linebreak()
linebreak() linebreak()
@ -395,15 +373,17 @@
{ {
uline(align: left, edu_prog.department_gen) uline(align: left, edu_prog.department_gen)
linebreak() linebreak()
uline(align: left, subjects.at(subject)) uline(align: left, uni.subjects.at(subject))
linebreak() linebreak()
uline(align: left, [#edu_prog.code #edu_prog.name-long]) uline(align: left, [#edu_prog.code #edu_prog.name_long])
}, },
) )
grid( grid(
columns: (1fr, 1fr, 1fr), columns: (1fr, 1fr, 1fr),
gutter: 0.3fr, 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() linebreak()
@ -675,6 +655,7 @@
#let pz-lb-template( #let pz-lb-template(
doc, doc,
doctype: none, doctype: none,
university: "ХНУРЕ",
edu_program: none, edu_program: none,
title: none, title: none,
subject: none, subject: none,
@ -686,13 +667,15 @@
show: style show: style
let uni = universities.at(university)
let edu_prog = uni.edu_programs.at(edu_program)
// page 1 {{{2 // page 1 {{{2
align(center)[ align(center)[
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \ МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ #upper(uni.name)
\ \ \ \
Кафедра #edu_programs.at(edu_program).department_gen Кафедра #edu_prog.department_gen
\ \ \ \ \ \
Звіт \ Звіт \
@ -703,7 +686,7 @@
[№#worknumber] [№#worknumber]
} }
з дисципліни: "#subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")" з дисципліни: "#uni.subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")"
з теми: "#title" з теми: "#title"
@ -722,8 +705,8 @@
if author.variant != none [Варіант: #author.variant] if author.variant != none [Варіант: #author.variant]
} else [ } else [
Виконали:\ Виконали:\
ст. гр. #authors.at(0).group\ ст. гр. #edu_program\-#authors.at(0).group\
#authors.map(a => [ #a.name\ ]) #for author in authors [#author.name\ ]
] ]
#colbreak() #colbreak()

22
template/config/doc.yaml Normal file
View File

@ -0,0 +1,22 @@
title: Потiк керування та алгоритмічні структури Bash
subject: СПМ
doctype: ЛБ
worknumber: 2
mentors:
- name: Шевченко Т. Г.
degree: Доцент кафедри ПІ
gender: m
- 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

View File

@ -1,8 +1,10 @@
#import "@local/nure:0.0.0": * #import "@local/nure:0.1.0": *
#let author = ( #let author = (
name: "Ситник Є. С.", name: "Ситник Є. С.",
full_name_gen: "Ситника Єгора Сергійовича", full_name_gen: "Ситника Єгора Сергійовича",
course: 2,
semester: 3,
variant: 13, variant: 13,
group: "23-2", group: "23-2",
gender: "m", gender: "m",

View File

@ -1,24 +1,6 @@
#import "@local/nure:0.1.0": * #import "@local/nure:0.1.0": *
#show: pz-lb-template.with( #show: pz-lb-template.with(..yaml("config/doc.yaml"))
doctype: "ЛБ",
edu_program: "ПЗПІ",
subject: "БД",
worknumber: 1,
title: "Інформаційна система «Помічник класного керівника». Керування класом",
authors: (
(
name: "Ситник Є. С.",
full_name_gen: "Ситника Єгора Сергійовича",
variant: 13,
group: "ПЗПІ-23-2",
gender: "m",
),
),
mentors: (
(name: "Черепанова Ю. Ю.", degree: "Ст. викл. каф. ПІ", gender: "f"),
),
)
#v(-spacing) #v(-spacing)