11 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
41dcbeb1ec feat!: bump version to 0.1.0
fix: adjust templates
style: reformat lib.typ w/ 120 column width
2025-03-13 12:37:58 +02:00
429f632841 fix!: remove unnecessary gender key in cw_template
fix: add more subjects
docs: unify comments with pz_lb_template
2025-03-13 12:35:12 +02:00
7 changed files with 101 additions and 80 deletions

View File

@ -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 -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
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": *
@ -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

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

86
lib.typ
View File

@ -1,31 +1,7 @@
// Academic aliases {{{1
/// subject abbreviations to full names
#let subjects = (
"БД": "Бази даних",
"ОТК": "Основи теорії кіл",
"ОПН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("config/universities.yaml")
// Template formatting functions {{{1
@ -97,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
@ -251,7 +230,11 @@
spacing: 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)
pad(it, left: 1.25cm)
@ -268,8 +251,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, 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.
/// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object.
@ -280,13 +263,14 @@
doc,
title: none,
subject: none,
university: "ХНУРЕ",
author: (),
mentors: (),
edu_program: none,
task_list: (),
calendar_plan: (),
abstract: (),
bib_path: "bibl.yml",
bib_path: none,
appendices: (),
) = {
set document(title: title, author: author.name)
@ -305,14 +289,14 @@
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
[
#set align(center)
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ\
#upper(uni.name)
\
@ -320,12 +304,9 @@
\
ПОЯСНЮВАЛЬНА ЗАПИСКА
ДО КУРСОВОЇ РОБОТИ
з дисципліни: "#subjects.at(subject, default: "NONE")"
ПОЯСНЮВАЛЬНА ЗАПИСКА\
ДО КУРСОВОЇ РОБОТИ\
з дисципліни: "#uni.subjects.at(subject, default: "NONE")"\
Тема роботи: "#title"
\ \ \
@ -333,7 +314,7 @@
#columns(2, gutter: 4cm)[
#set align(left)
#if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #author.group
#if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #edu_program\-#author.group
\
Керівник:\
@ -377,7 +358,7 @@
// page 2 {{{2
{
uline[Харківський національний університет радіоелектроніки]
uline[#uni.name]
linebreak()
linebreak()
@ -392,15 +373,17 @@
{
uline(align: left, edu_prog.department_gen)
linebreak()
uline(align: left, subjects.at(subject))
uline(align: left, uni.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(
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()
@ -672,6 +655,7 @@
#let pz-lb-template(
doc,
doctype: none,
university: "ХНУРЕ",
edu_program: none,
title: none,
subject: none,
@ -683,13 +667,15 @@
show: style
let uni = universities.at(university)
let edu_prog = uni.edu_programs.at(edu_program)
// page 1 {{{2
align(center)[
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
#upper(uni.name)
\ \
Кафедра #edu_programs.at(edu_program).department_gen
Кафедра #edu_prog.department_gen
\ \ \
Звіт \
@ -700,7 +686,7 @@
[№#worknumber]
}
з дисципліни: "#subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")"
з дисципліни: "#uni.subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")"
з теми: "#title"
@ -719,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()

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,17 +1,19 @@
#import "@local/nure:0.0.0": *
#import "@local/nure:0.1.0": *
#let author = (
name: "Ситник Є. С.",
full_name_gen: "Ситника Єгора Сергійовича",
course: 2,
semester: 3,
variant: 13,
group: "23-2",
gender: "m",
)
#let mentors = (
(name: "Черепанова Ю. Ю.", gender: "f", degree: "Ст. викл. каф. ПІ"),
(name: "Русакова Н. Є.", gender: "f", degree: "Доц. каф. ПІ"),
(name: "Широкопетлєва М. С.", gender: "f", degree: "Ст. викл. каф. ПІ"),
(name: "Черепанова Ю. Ю.", degree: "Ст. викл. каф. ПІ"),
(name: "Русакова Н. Є.", degree: "Доц. каф. ПІ"),
(name: "Широкопетлєва М. С.", degree: "Ст. викл. каф. ПІ"),
)
#let task_list = (

View File

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

View File

@ -1,6 +1,6 @@
[package]
name = "nure"
version = "0.0.0"
version = "0.1.0"
entrypoint = "lib.typ"
authors = ["linerds"]
license = "GPL-3.0"