Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9abbc7c1e1 | |||
| ffa3ce0bdc | |||
| ea4a5a007b | |||
| 1e3b1ce114 | |||
| 1723c5f051 | |||
| 1a7fe4a394 | |||
| af2ba45a16 | |||
| 450b94cede | |||
| f698299a2d | |||
| 9578b5e4f1 | |||
| 8df87de797 | |||
| 6d6e94f0ba | |||
|
a9475dbc94
|
|||
|
19c5fdf19c
|
|||
|
833a179ced
|
|||
| c1f128b528 | |||
| bbdc0d8209 | |||
| 7fb1fd1391 | |||
| cee212ae0a | |||
| 549d7f060f | |||
| 73ab5c8f08 | |||
| 96f5070167 | |||
| 5cc95f17c7 | |||
| c49e911aad | |||
| c1490ce893 | |||
| 79579208fa | |||
| 5bd47ac4c1 | |||
| 6cb71054cf | |||
| b28578be34 | |||
| 3ece994ced | |||
| 6e10c4ae2b | |||
| 3e6f3bf7c4 | |||
| 8dcbee291c | |||
| 4a78f8f3ee | |||
| 648824fd46 | |||
|
1d6412c60f
|
|||
|
3ba9990dc1
|
|||
|
2e65baae70
|
|||
| d338c21965 | |||
| 7e15ea09d4 | |||
|
3b3d62fd9b
|
|||
|
04c5b283e7
|
|||
|
3ca8409e58
|
|||
|
e0811afaae
|
|||
|
7ec79ee898
|
|||
|
47117749cf
|
|||
|
e214656166
|
|||
|
99234a73a9
|
|||
| 901d670a1c | |||
| 594e908bb1 | |||
|
32c6a1663c
|
|||
|
9cc7229851
|
|||
|
1646f5249b
|
|||
|
2de5cb4c58
|
|||
|
dec7c58db2
|
|||
|
2653e7dba2
|
|||
|
816d07f745
|
|||
| 7799435039 | |||
| 5be6cea4fb | |||
| 5bc79a196e | |||
| c1ad952c7c | |||
| dc3358d986 | |||
| 6bf37099b4 | |||
| bf00b3de5d | |||
| c049a9a3ce | |||
| 22fb1de736 | |||
| 1db499dad4 | |||
| 41dcbeb1ec | |||
| 429f632841 | |||
| b3214e2150 | |||
| d60d3a9c89 | |||
| 63dbd82e4d | |||
| 0b8ceda4f1 | |||
| cf10e0fbdc | |||
| 33d067b67e | |||
| 0e0dc20e9b | |||
| b8a309ad2c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
||||
template.pdf
|
||||
*.pdf
|
||||
|
||||
155
README.md
155
README.md
@@ -1,4 +1,5 @@
|
||||
# Typst Template for NURE Works
|
||||
<img src="assets/pz-lb_title_page.png" alt="pz-lb title page" width=350>
|
||||
|
||||
## General Info
|
||||
|
||||
@@ -6,66 +7,176 @@ This project contains two template functions and some utilities for writing NURE
|
||||
|
||||
### Templates
|
||||
|
||||
#### `pz-lb-template` - For Laboratory and Practical Works
|
||||
#### `pz-lb` - For Practice and Laboratory 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
|
||||
#### `coursework` - For Course Works
|
||||
This template:
|
||||
- Sets up document styles;
|
||||
- Formats the title, task, calendar plan, and abstract pages;
|
||||
- Typesets the bibliography, outline, and appendices according to standard requirements.
|
||||
- Typesets the bibliography according to ДСТУ 3008:2015 using custom CSL style;
|
||||
- Typesets the outline and appendices according to standard requirements.
|
||||
|
||||
|
||||
### Utilities
|
||||
- `nheading` - For unnumbered headings, such as "Introduction" and "Conclusion".
|
||||
- `hfill` - Fills horizontal space with a filled box instead of just empty space; useful for creating underlines.
|
||||
- `uline` - Creates underlined fields that need to be filled, such as the name field on the task list.
|
||||
- `bold` - Inserts bold text inside functional environments.
|
||||
- `img` - Inserts images with a caption, automatically deriving the label from the image file name.
|
||||
- `img` - Inserts images with a caption, automatically deriving the label from the image file name (use via `#import "@local/nure:0.1.1": utils` and call `utils.img`).
|
||||
|
||||
**Note:** `img()` is provided in `template/utils.typ` so you can copy it into your project root for compatibility, until [path() type](https://github.com/typst/typst/pull/7555) is released.
|
||||
|
||||
## Usage
|
||||
|
||||
### 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.1 https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local/share/typst/packages/local/nure/0.1.1
|
||||
```
|
||||
2. Init your project with Typst:
|
||||
```bash
|
||||
typst init @local/nure:0.0.0 project-name
|
||||
typst init @local/nure:0.1.1 project-name
|
||||
```
|
||||
|
||||
### As a file in your project
|
||||
Include lib.typ in your project and utilize the provided functions:
|
||||
### As a standalone file
|
||||
Copy `src/` to your project's root directory, optionally renaming `src/` to `lib/` (then import `src/lib.typ` or `lib/lib.typ` accordingly).
|
||||
|
||||
### In your project
|
||||
```typst
|
||||
// Import the template
|
||||
#import "lib.typ": *
|
||||
// Import the template either from a local package...
|
||||
#import "@local/nure:0.1.1": *
|
||||
// ...or by importing a lib.typ directly
|
||||
// #import "/lib/lib.typ": *
|
||||
|
||||
// Setup the document
|
||||
#show: lab-pz-template.with(
|
||||
title: "Some title",
|
||||
// NOTE: all template arguments use kebab-case.
|
||||
|
||||
// 1. Setup the document
|
||||
// by setting values directly...
|
||||
#show: pz-lb.with(
|
||||
title: "Some title",
|
||||
// ...
|
||||
)
|
||||
// ...or using a yaml/toml file
|
||||
#show: pz-lb.with(..toml("/doc.toml"))
|
||||
|
||||
// this template automatically inserts a `=title`
|
||||
|
||||
// Write your content
|
||||
#v(-spacing) // remove spacing between headings
|
||||
== Purpose
|
||||
Some text
|
||||
|
||||
// ...or include your modules
|
||||
#include "chapters/intro.typ"
|
||||
#include "chapters/chapter1.typ"
|
||||
#include "chapters/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 (e.g. #import "@local/nure:0.1.1": utils).
|
||||
|
||||
|
||||
// If you ever need appendices in pz-lb template use the show rule
|
||||
// WARNING: when using coursework template use its own argument,
|
||||
// so it can put bibliography before appendices
|
||||
#show: style.appendices
|
||||
|
||||
// For coursework appendices, pass them via `appendices:` argument instead.
|
||||
|
||||
= Quote
|
||||
#link("https://youtu.be/bJQj1uKtnus")[
|
||||
The art isn't the art, the art is never the art,
|
||||
the art is the thing that happens inside you when you make it and the feeling in the heart of the beholder.
|
||||
]
|
||||
```
|
||||
|
||||
And a TOML file would look like this:
|
||||
```toml
|
||||
# university = "ХНУРЕ" # "ХНУРЕ" is the default
|
||||
# edu-program = "ПЗПІ" # can be null, sourced from authors.first() by default
|
||||
|
||||
subject = "СМП"
|
||||
doctype = "ЛБ"
|
||||
worknumber = 2
|
||||
title = "Потiк керування та алгоритмічні структури Bash"
|
||||
|
||||
[[mentors]]
|
||||
name = "Шевченко Т. Г."
|
||||
degree = "Доцент кафедри ПІ"
|
||||
gender = "m"
|
||||
|
||||
[[mentors]]
|
||||
name = "Франко І. Я."
|
||||
degree = "Асистент кафедри ПІ"
|
||||
gender = "m"
|
||||
|
||||
[[authors]]
|
||||
name = "Косач Л. П."
|
||||
edu-program = "ПЗПІ"
|
||||
group = "23-2"
|
||||
gender = "f"
|
||||
variant = 8
|
||||
# For coursework
|
||||
full-name-gen = "Косач Лариси Петрівни"
|
||||
course = 2
|
||||
semester = 4
|
||||
```
|
||||
|
||||
### Notes:
|
||||
1. Use `#v(-spacing)` to remove vertical spacing between titles (this cannot be automatically handled by the template). Variable `spacing` used here is imported from the template.
|
||||
2. When importing `@local/nure:0.1.1` and specifying file paths in functions handled by the package, the path will be relative to the package root, e.g. setting `#show: coursework.with(bib-path: "bibl.yml")` will evaluate to `~/.local/share/typst/packages/local/nure/0.1.1/bibl.yml`. The same applies to `utils.img` unless you copy `template/utils.typ` into your project root and import from there.
|
||||
|
||||
### Bibliography Format
|
||||
The template uses a custom CSL (Citation Style Language) file located at `src/csl/dstu-3008-2015.csl` to format bibliography entries.
|
||||
|
||||
Supported bibliography entry types in `bibl.yml`:
|
||||
- **Book**: Books with author, title, publisher, year, and page count
|
||||
- **Web**: Web resources with title, author/organization, URL, and access date
|
||||
|
||||
**Warning:** Other types were added by Kimi K2.5 without any additional checks for compliance.
|
||||
|
||||
Example `bibl.yml`:
|
||||
```yaml
|
||||
mysql:
|
||||
type: Book
|
||||
title: MySQL Language Reference
|
||||
author: Ab M.
|
||||
publisher: MySQL Press
|
||||
date: 2004
|
||||
page-total: 600
|
||||
|
||||
go:
|
||||
type: Web
|
||||
title: The Go Programming Language
|
||||
author: The Go Programming Language
|
||||
url:
|
||||
value: https://go.dev/
|
||||
date: 2024-12-10
|
||||
```
|
||||
|
||||
### Example Project Structure
|
||||
```
|
||||
project-folder/
|
||||
├── main.typ
|
||||
├── template.typ
|
||||
├── images/
|
||||
│ ├── figure1.png
|
||||
│ ├── figure2.png
|
||||
│ ├── ...
|
||||
├── ...
|
||||
project/
|
||||
├── doc.toml -- for things that don't change across works, i.e. author and mentor metadata
|
||||
├── main.typ -- for boilerplate code and importing everything
|
||||
├── utils.typ -- for helper functions
|
||||
├── chapters/
|
||||
│ ├── intro.typ
|
||||
│ ├── chapter1.typ
|
||||
│ ├── chapter2.typ
|
||||
│ └── ...
|
||||
├── figures/
|
||||
│ ├── chapter1/
|
||||
│ │ ├── figure1.png
|
||||
│ │ ├── figure2.png
|
||||
│ │ ├── figure3.png
|
||||
│ │ └── ...
|
||||
│ ├── chapter2/
|
||||
│ │ ├── figure1.png
|
||||
│ │ ├── figure2.png
|
||||
│ │ ├── figure3.png
|
||||
│ │ └── ...
|
||||
│ └── ...
|
||||
└── ...
|
||||
```
|
||||
|
||||
BIN
assets/pz-lb_title_page.png
Normal file
BIN
assets/pz-lb_title_page.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
707
lib.typ
707
lib.typ
@@ -1,707 +0,0 @@
|
||||
|
||||
// Academic aliases {{{1
|
||||
|
||||
/// subject abbreviations to full names
|
||||
#let subjects = (
|
||||
"БД": "Бази даних",
|
||||
"ОПНJ": "Основи програмування на Java",
|
||||
"ОС": "Операційні системи",
|
||||
"ПП": "Проектний практикум",
|
||||
"СПМ": "Скриптові мови програмування",
|
||||
"Ф": "Філософія",
|
||||
)
|
||||
|
||||
/// education program abbreviations to name & number
|
||||
#let edu_programs = (
|
||||
"ПЗПІ": (
|
||||
name: "Інженерія програмного забезпечення",
|
||||
number: 121, // TODO: ПЗПІ is "F2" now
|
||||
),
|
||||
)
|
||||
|
||||
// Template formatting functions {{{1
|
||||
|
||||
/// numberless heading
|
||||
#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
|
||||
|
||||
/// make underlined cell with filled value
|
||||
#let uline(align: center, content) = underline[
|
||||
#if align != left { hfill(1fr) }
|
||||
#content
|
||||
#if align != right { hfill(1fr) }
|
||||
]
|
||||
|
||||
/// bold text
|
||||
#let bold(content) = text(weight: "bold")[#content]
|
||||
|
||||
/// month name from its number
|
||||
#let month_gen(month) = (
|
||||
"січня",
|
||||
"лютого",
|
||||
"березня",
|
||||
"квітня",
|
||||
"травня",
|
||||
"червня",
|
||||
"липня",
|
||||
"серпня",
|
||||
"вересня",
|
||||
"жовтня",
|
||||
"листопада",
|
||||
"грудня",
|
||||
).at(month - 1)
|
||||
|
||||
// Helper functions {{{1
|
||||
|
||||
/// captioned image with label derived from path:
|
||||
/// - "image.png" = @image
|
||||
/// - "img/image.png" = @image
|
||||
/// - "img/foo/image.png" = @foo_image
|
||||
/// - "img/foo/foo_image.png" = @foo_image
|
||||
/// the caption will be modified based on a conditional positional value:
|
||||
/// - `none`: no change
|
||||
/// - some value: "`caption` (за даними `value`)"
|
||||
/// - no value: "`caption` (рисунок виконано самостійно)"
|
||||
/// additional named arguments will be passed to original `image` function
|
||||
#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)) {
|
||||
// ("image",), (_, "image") and (.., "img", "img_image")
|
||||
parts.last()
|
||||
} else {
|
||||
// (.., "img", "image") = "img_image"
|
||||
parts.at(-2) + "_" + parts.at(-1)
|
||||
}.replace(" ", "_")
|
||||
|
||||
let caption = if sink.pos().len() == 0 {
|
||||
caption + " (рисунок виконано самостійно)"
|
||||
} else if sink.pos().first() == none {
|
||||
caption
|
||||
} else {
|
||||
[#caption (за даними #sink.pos().first())]
|
||||
}
|
||||
|
||||
[#figure(image(path, ..sink.named()), caption: caption) #label(label_string)]
|
||||
}
|
||||
|
||||
// Styling {{{1
|
||||
/// NOTE: may be wrong
|
||||
#let ua_alpha_numbering = "абвгдежиклмнпрстуфхцшщюя".split("") // 0 = "", 1 = "а"
|
||||
|
||||
// general outlook {{{2
|
||||
// spacing between lines
|
||||
#let spacing = 0.95em
|
||||
|
||||
#let style(it) = {
|
||||
set page(
|
||||
paper: "a4",
|
||||
margin: (top: 20mm, right: 10mm, bottom: 20mm, left: 25mm),
|
||||
number-align: top + right,
|
||||
numbering: (..numbers) => {
|
||||
if numbers.pos().at(0) != 1 {
|
||||
numbering("1", numbers.pos().at(0))
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
// set 1.5 line spacing
|
||||
set block(spacing: spacing)
|
||||
set par(spacing: spacing)
|
||||
set par(leading: spacing)
|
||||
|
||||
// enums and lists {{{2
|
||||
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
|
||||
}
|
||||
|
||||
set list(indent: 1.35cm, body-indent: 0.5cm, marker: [--])
|
||||
|
||||
// figures {{{2
|
||||
show figure: it => {
|
||||
v(spacing * 2, weak: true)
|
||||
it
|
||||
v(spacing * 2, weak: true)
|
||||
}
|
||||
|
||||
set figure.caption(separator: [ -- ])
|
||||
show figure.where(kind: table): set figure.caption(position: top)
|
||||
show figure.caption.where(kind: table): set align(left)
|
||||
|
||||
// figure numbering
|
||||
show heading.where(level: 1): it => {
|
||||
counter(math.equation).update(0)
|
||||
counter(figure.where(kind: image)).update(0)
|
||||
counter(figure.where(kind: table)).update(0)
|
||||
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()))
|
||||
|
||||
// appearance of references to images and tables {{{2
|
||||
set ref(
|
||||
supplement: it => {
|
||||
if it == none or not it.has("kind") {
|
||||
it
|
||||
} else if it.kind == image {
|
||||
"див. рис."
|
||||
} else if it.kind == table {
|
||||
"див. таблицю"
|
||||
} else {
|
||||
it
|
||||
}
|
||||
},
|
||||
)
|
||||
show ref: it => {
|
||||
let el = it.element
|
||||
|
||||
if el == none or not el.has("kind") {
|
||||
return it
|
||||
}
|
||||
if el.kind != image and el.kind != table {
|
||||
return it
|
||||
}
|
||||
|
||||
[(#it)]
|
||||
}
|
||||
|
||||
// headings {{{2
|
||||
set heading(numbering: "1.1")
|
||||
|
||||
show heading.where(level: 1): it => {
|
||||
set align(center)
|
||||
set text(size: 14pt, weight: "semibold")
|
||||
|
||||
pagebreak(weak: true)
|
||||
upper(it)
|
||||
v(spacing * 2, weak: true)
|
||||
}
|
||||
show heading.where(level: 2): it => {
|
||||
set text(size: 14pt, weight: "regular")
|
||||
|
||||
v(spacing * 2, weak: true)
|
||||
block(width: 100%, spacing: 0em)[
|
||||
#h(1.25cm)
|
||||
#counter(heading).display(it.numbering)
|
||||
#it.body
|
||||
]
|
||||
v(spacing * 2, weak: true)
|
||||
}
|
||||
|
||||
show heading.where(level: 3): it => {
|
||||
set text(size: 14pt, weight: "regular")
|
||||
|
||||
v(spacing * 2, weak: true)
|
||||
block(width: 100%, spacing: 0em)[
|
||||
#h(1.25cm)
|
||||
#counter(heading).display(it.numbering)
|
||||
#it.body
|
||||
]
|
||||
v(spacing * 2, weak: true)
|
||||
}
|
||||
|
||||
// listings {{{2
|
||||
show raw: it => {
|
||||
let new_spacing = 0.5em
|
||||
set block(spacing: new_spacing)
|
||||
set par(
|
||||
spacing: new_spacing,
|
||||
leading: new_spacing,
|
||||
)
|
||||
set text(size: 11pt, font: "Courier New", weight: "semibold")
|
||||
|
||||
v(spacing * 2.5, weak: true)
|
||||
pad(it, left: 1.25cm)
|
||||
v(spacing * 2.5, weak: true)
|
||||
}
|
||||
|
||||
it
|
||||
}
|
||||
|
||||
// Coursework template {{{1
|
||||
|
||||
/// DSTU 3008:2015 Template for NURE
|
||||
/// -> 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.
|
||||
/// - 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.
|
||||
/// - 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.
|
||||
/// - bib_path path: Path to the bibliography yaml file.
|
||||
/// - appendices (content): Content with appendices.
|
||||
#let cw-template(
|
||||
doc,
|
||||
title: "NONE",
|
||||
subject_shorthand: "NONE",
|
||||
department_gen: "Програмної інженерії",
|
||||
author: (),
|
||||
mentors: (),
|
||||
edu_program_shorthand: "ПЗПІ",
|
||||
task_list: (),
|
||||
calendar_plan: (),
|
||||
abstract: (),
|
||||
bib_path: "bibl.yml",
|
||||
appendices: (),
|
||||
) = {
|
||||
set document(title: title, author: author.name)
|
||||
|
||||
show: style
|
||||
|
||||
let bib-count = state("citation-counter", ())
|
||||
show cite: it => {
|
||||
it
|
||||
bib-count.update(((..c)) => (..c, it.key))
|
||||
}
|
||||
show bibliography: it => {
|
||||
set text(size: 0pt)
|
||||
it
|
||||
}
|
||||
|
||||
|
||||
let head_mentor = mentors.at(0)
|
||||
let edu_program = edu_programs.at(edu_program_shorthand)
|
||||
|
||||
// page 1 {{{2
|
||||
[
|
||||
#set align(center)
|
||||
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ
|
||||
|
||||
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
|
||||
|
||||
\
|
||||
|
||||
Кафедра Програмної інженерії
|
||||
|
||||
\
|
||||
|
||||
ПОЯСНЮВАЛЬНА ЗАПИСКА
|
||||
|
||||
ДО КУРСОВОЇ РОБОТИ
|
||||
|
||||
з дисципліни: "#subjects.at(subject_shorthand, default: "NONE")"
|
||||
|
||||
Тема роботи: "#title"
|
||||
|
||||
\ \ \
|
||||
|
||||
#columns(2, gutter: 4cm)[
|
||||
#set align(left)
|
||||
|
||||
#if author.gender == "m" { [Виконав\ ] } else { [Виконала\ ] } ст. гр. #author.group
|
||||
|
||||
\
|
||||
Керівник:\
|
||||
#head_mentor.degree
|
||||
|
||||
\
|
||||
Робота захищена на оцінку
|
||||
|
||||
\
|
||||
Комісія:\
|
||||
#for mentor in mentors {
|
||||
[#mentor.degree\
|
||||
]
|
||||
}
|
||||
|
||||
#colbreak()
|
||||
#set align(left)
|
||||
|
||||
\
|
||||
#author.name
|
||||
|
||||
\ \
|
||||
#head_mentor.name
|
||||
|
||||
\
|
||||
#underline(" " * 35)
|
||||
|
||||
\ \
|
||||
#for mentor in mentors {
|
||||
[#mentor.name\
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
Харків -- #task_list.done_date.display("[year]")
|
||||
|
||||
#pagebreak()
|
||||
]
|
||||
|
||||
// page 2 {{{2
|
||||
{
|
||||
uline[Харківський національний університет радіоелектроніки]
|
||||
|
||||
linebreak()
|
||||
linebreak()
|
||||
|
||||
grid(
|
||||
columns: (100pt, 1fr),
|
||||
bold[
|
||||
Кафедра
|
||||
Дисципліна
|
||||
Спеціальність
|
||||
],
|
||||
{
|
||||
uline(align: left, department_gen)
|
||||
linebreak()
|
||||
uline(align: left, subjects.at(subject_shorthand))
|
||||
linebreak()
|
||||
uline(align: left, [#edu_program.number #edu_program.name])
|
||||
},
|
||||
)
|
||||
grid(
|
||||
columns: (1fr, 1fr, 1fr),
|
||||
gutter: 0.3fr,
|
||||
[#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)],
|
||||
)
|
||||
|
||||
linebreak()
|
||||
linebreak()
|
||||
linebreak()
|
||||
|
||||
align(center, bold[ЗАВДАННЯ \ на курсову роботу студента])
|
||||
|
||||
linebreak()
|
||||
|
||||
uline(align: left)[_#author.full_name_gen _]
|
||||
|
||||
linebreak()
|
||||
linebreak()
|
||||
|
||||
bold[\1. Тема роботи:]
|
||||
uline[#title.]
|
||||
|
||||
linebreak()
|
||||
|
||||
{
|
||||
bold[\2. Строк здачі закінченої роботи:]
|
||||
uline(task_list.done_date.display("[day].[month].[year]"))
|
||||
hfill(10fr)
|
||||
}
|
||||
|
||||
linebreak()
|
||||
|
||||
bold[\3. Вихідні дані для роботи:]
|
||||
uline(task_list.source)
|
||||
|
||||
linebreak()
|
||||
|
||||
bold[\4. Зміст розрахунково-пояснювальної записки:]
|
||||
uline(task_list.content)
|
||||
|
||||
linebreak()
|
||||
|
||||
bold[\5. Перелік графічного матеріалу:]
|
||||
uline(task_list.graphics)
|
||||
|
||||
linebreak()
|
||||
|
||||
{
|
||||
bold[\6. Дата видачі завдання:]
|
||||
uline(task_list.initial_date.display("[day].[month].[year]"))
|
||||
hfill(10fr)
|
||||
}
|
||||
|
||||
pagebreak()
|
||||
}
|
||||
|
||||
// page 3 {{{2
|
||||
{
|
||||
align(center, bold[КАЛЕНДАРНИЙ ПЛАН])
|
||||
set par(first-line-indent: 0pt)
|
||||
|
||||
linebreak()
|
||||
|
||||
calendar_plan.plan_table
|
||||
|
||||
linebreak()
|
||||
|
||||
grid(
|
||||
columns: (5fr, 5fr),
|
||||
grid(
|
||||
columns: (1fr, 2fr, 1fr),
|
||||
gutter: 0.2fr,
|
||||
[
|
||||
Студент \
|
||||
Керівник \
|
||||
#align(center)["#underline[#calendar_plan.approval_date.day()]"]
|
||||
],
|
||||
[
|
||||
#uline(align: center, []) \
|
||||
#uline(align: center, []) \
|
||||
#uline(align: center, month_gen(calendar_plan.approval_date.month()))
|
||||
],
|
||||
[
|
||||
\ \
|
||||
#underline[#calendar_plan.approval_date.year()] р.
|
||||
],
|
||||
),
|
||||
[
|
||||
#author.name, \
|
||||
#head_mentor.degree
|
||||
#head_mentor.name.
|
||||
],
|
||||
)
|
||||
|
||||
pagebreak()
|
||||
}
|
||||
|
||||
// page 4 {{{2
|
||||
[
|
||||
#align(center, bold[РЕФЕРАТ]) \
|
||||
|
||||
#context [
|
||||
#let pages = counter(page).final().at(0)
|
||||
#let images = query(figure.where(kind: image)).len()
|
||||
#let tables = query(figure.where(kind: table)).len()
|
||||
#let bibs = bib-count.final().dedup().len()
|
||||
/* TODO: why this stopped working?
|
||||
#let tables = counter(figure.where(kind: table)).final().at(0)
|
||||
#let images = counter(figure.where(kind: image)).final().at(0)*/
|
||||
|
||||
#let counters = ()
|
||||
|
||||
#if pages != 0 { counters.push[#pages с.] }
|
||||
#if tables != 0 { counters.push[#tables табл.] }
|
||||
#if images != 0 { counters.push[#images рис.] }
|
||||
#if bibs != 0 { counters.push[#bibs джерел] }
|
||||
|
||||
Пояснювальна записка до курсової роботи: #counters.join(", ").
|
||||
]
|
||||
|
||||
\
|
||||
|
||||
#{
|
||||
let keywords = abstract.keywords.map(upper)
|
||||
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)))
|
||||
or (
|
||||
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.join(", ")
|
||||
}
|
||||
|
||||
\
|
||||
|
||||
#abstract.text
|
||||
]
|
||||
|
||||
// page 5 {{{2
|
||||
outline(
|
||||
title: [
|
||||
ЗМІСТ
|
||||
#v(spacing * 2, weak: true)
|
||||
],
|
||||
depth: 2,
|
||||
indent: auto,
|
||||
)
|
||||
|
||||
doc
|
||||
|
||||
// bibliography {{{2
|
||||
{
|
||||
heading(depth: 1, numbering: none)[Перелік джерел посилання]
|
||||
|
||||
bibliography(
|
||||
bib_path,
|
||||
style: "ieee",
|
||||
full: true,
|
||||
title: none,
|
||||
)
|
||||
|
||||
let bib_data = yaml(bib_path)
|
||||
|
||||
let format-entry(citation) = {
|
||||
if (citation.type == "Web") {
|
||||
let date_array = citation.url.date.split("-")
|
||||
let date = datetime(
|
||||
year: int(date_array.at(0)),
|
||||
month: int(date_array.at(1)),
|
||||
day: int(date_array.at(2)),
|
||||
)
|
||||
[
|
||||
#citation.title.
|
||||
#citation.author.
|
||||
URL: #citation.url.value (дата звернення: #date.display("[day].[month].[year]")).
|
||||
]
|
||||
} else if citation.type == "Book" [
|
||||
#citation.author
|
||||
#citation.title.
|
||||
#citation.publisher,
|
||||
#citation.date.
|
||||
#citation.page-total c.
|
||||
] else [
|
||||
UNSUPPORTED BIBLIOGRAPHY ENTRY TYPE, PLEASE OPEN AN ISSUE
|
||||
]
|
||||
}
|
||||
|
||||
show enum.item: it => {
|
||||
set par(first-line-indent: 0pt)
|
||||
box(width: 1.25cm)
|
||||
box(width: 1em + 0.5cm)[#it.number.]
|
||||
it.body
|
||||
linebreak()
|
||||
}
|
||||
|
||||
context {
|
||||
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)),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// appendices {{{2
|
||||
{
|
||||
counter(heading).update(0)
|
||||
|
||||
set heading(
|
||||
numbering: (i, ..nums) => {
|
||||
let char = upper(ua_alpha_numbering.at(i))
|
||||
if nums.pos().len() == 0 { char } else {
|
||||
char + "." + nums.pos().map(str).join(".")
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
show heading.where(level: 1): it => {
|
||||
set align(center)
|
||||
set text(size: 14pt, weight: "regular")
|
||||
|
||||
pagebreak(weak: true)
|
||||
bold[ДОДАТОК #counter(heading).display(it.numbering)]
|
||||
linebreak()
|
||||
it.body
|
||||
v(spacing * 2, weak: true)
|
||||
}
|
||||
|
||||
show heading.where(level: 2): it => {
|
||||
set text(size: 14pt, weight: "regular")
|
||||
|
||||
v(spacing * 2, weak: true)
|
||||
block(width: 100%, spacing: 0em)[
|
||||
#h(1.25cm)
|
||||
#counter(heading).display(it.numbering)
|
||||
#it.body
|
||||
]
|
||||
v(spacing * 2, weak: true)
|
||||
}
|
||||
|
||||
appendices
|
||||
}
|
||||
}
|
||||
|
||||
// Laboratory work template {{{1
|
||||
|
||||
/// DSTU 3008:2015 Template for NURE
|
||||
/// -> content
|
||||
/// - doc (content): Content to apply the template to.
|
||||
/// - doctype ("ЛБ" | "ПЗ"): Document type.
|
||||
/// - title (str): Title of the document.
|
||||
/// - subject_shorthand (str): Subject short name.
|
||||
/// - 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.
|
||||
#let lab-pz-template(
|
||||
doc,
|
||||
doctype: "NONE",
|
||||
title: "NONE",
|
||||
subject_shorthand: "NONE",
|
||||
department_gen: "Програмної інженерії",
|
||||
worknumber: 1,
|
||||
authors: (),
|
||||
mentor: (),
|
||||
) = {
|
||||
set document(title: title, author: authors.at(0).name)
|
||||
|
||||
show: style
|
||||
|
||||
context counter(heading).update(worknumber - 1)
|
||||
|
||||
// page 1 {{{2
|
||||
align(center)[
|
||||
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \
|
||||
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
|
||||
|
||||
\ \
|
||||
Кафедра #department_gen
|
||||
|
||||
\ \ \
|
||||
Звіт \
|
||||
з
|
||||
#if doctype == "ЛБ" [лабораторної роботи] else [практичної роботи]
|
||||
#if worknumber != none [№ #worknumber]
|
||||
|
||||
з дисципліни: "#subjects.at(subject_shorthand, default: "UNLNOWN SUBJECT, PLEASE OPEN AN ISSUE")"
|
||||
|
||||
з теми: "#title"
|
||||
|
||||
\ \ \ \
|
||||
|
||||
#columns(2)[
|
||||
#set align(left)
|
||||
#set par(first-line-indent: 0pt)
|
||||
#if authors.len() == 1 {
|
||||
let author = authors.at(0)
|
||||
if author.gender == "m" [Виконав:\ ] else [Виконала:\ ]
|
||||
[
|
||||
ст. гр. #author.group\
|
||||
#author.name\
|
||||
]
|
||||
if author.variant != none [Варіант: №#author.variant]
|
||||
} else [
|
||||
Виконали:\
|
||||
ст. гр. #authors.at(0).group\
|
||||
#authors.map(a => [ #a.name\ ])
|
||||
]
|
||||
|
||||
#colbreak()
|
||||
#set align(right)
|
||||
|
||||
#if mentor.gender == "m" { [Перевірив:\ ] } else { [Перевірила:\ ] }
|
||||
#mentor.degree #if mentor.degree.len() >= 15 [\ ]
|
||||
#mentor.name\
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
Харків -- #datetime.today().display("[year]")
|
||||
]
|
||||
|
||||
pagebreak(weak: true)
|
||||
|
||||
heading(title)
|
||||
doc
|
||||
}
|
||||
|
||||
// vim:sts=2:sw=2:fdl=0:fdm=marker:cms=/*%s*/
|
||||
93
src/config/universities.yaml
Normal file
93
src/config/universities.yaml
Normal file
@@ -0,0 +1,93 @@
|
||||
ХНУРЕ:
|
||||
name: Харківський національний університет радіоелектроніки
|
||||
name-en: Kharkiv National University of Radioelectronics
|
||||
edu-programs:
|
||||
ПЗПІ:
|
||||
name-long: Інженерія програмного забезпечення
|
||||
department-gen: Програмної інженерії
|
||||
code: 121 # TODO: change to F2?
|
||||
КУІБ:
|
||||
name-long: Управління інформаційною безпекою
|
||||
department-gen: Інфокомунікаційної інженерії ім. В. В. Поповського
|
||||
code: 125 # TODO: change to F5?
|
||||
description: Кібербезпека та захист інформації
|
||||
КНТ:
|
||||
name-en: CST # computer sciences and technologies
|
||||
name-long: Комп'ютерні науки та технології
|
||||
department-gen: Системотехніки
|
||||
department-en: ST
|
||||
code: 122
|
||||
subjects:
|
||||
DMT: Decision making theory
|
||||
ODS: Основи Dаtа Sсіеnсе # NOTE: Eng O here
|
||||
ІМ: Іноземна мова
|
||||
ІТР: Information Technologies of Reengineering
|
||||
ІТРОІ: Інтернет-технології Розподіленої Обробки Інформації
|
||||
АВпЗ: Аналіз вимог до програмного забезпечення
|
||||
АДан: Аналітика даних
|
||||
АКтаК: Архітектура комп'ютера та комп'ютерних мереж
|
||||
АТСД: Алгоритми та структури даних
|
||||
АтаРК: Аналіз та рефакторинг коду
|
||||
БД: Бази даних
|
||||
БЖД: Безпека життєдіяльності
|
||||
ВДІТБ: Введення до ІТ-бізнесу # NOTE: all in UA
|
||||
ВМ: Вища математика
|
||||
ГТГ: Гіпертекст та гіпермедіа
|
||||
ДМ: Дискретна математика
|
||||
ДПК: Динаміка Проектних Команд
|
||||
ЕРВ: Електрорадіовимірювання
|
||||
КДМА: Комп'ютерна дискретна математика
|
||||
КЗВШ: Креативність з використанням штучного інтелекту
|
||||
КМ: Комп`ютерні мережі
|
||||
ЛМВ: Людино-машинна взаємодія
|
||||
ЛМтБ: Локальні мережі та їх безпека # бидло не знає що українською "їхня"
|
||||
МОКр: Математичні основи криптології
|
||||
МОТДО: Методи оптимізаціі та дослідження операцій
|
||||
МППС: Methodologies of designing software systems
|
||||
МС: Моделювання систем
|
||||
ОІМ: Основи IP-мереж
|
||||
ООАПС: Об'єктно-орієнтований аналіз в проектуванні систем
|
||||
ООП: Об'єктно-орієнтоване програмування
|
||||
ОП: Основи права
|
||||
ОПІ: Основи програмноі інженеріі
|
||||
ОПНJ: Основи програмування на Java
|
||||
ОПр: Основи програмування
|
||||
ОРвІТ: Оцінка Ризиків в IT-проектах
|
||||
ОС: Операційні системи
|
||||
ОТК: Основи теорії кіл
|
||||
ПБІП: Проектування та балансування ігрового процесу
|
||||
ПВJ: Поглиблене вивчення Java
|
||||
ПЕСЕ: Психологія екстремальних стосунків та ефективної адаптації
|
||||
ПНП: Програмування на платформі .NЕТ
|
||||
ПП: Проектний практикум
|
||||
ПРОГ: Програмування
|
||||
ПарП: Параллельне програмування
|
||||
СА: Системний аналіз
|
||||
СМП: Скриптові мови програмування
|
||||
СОАПЗ: Сервіс-Орієнтована Архітектура Програмного Забезпечення
|
||||
СРБД: Серверні рішення баз даних
|
||||
СхТ: Схемотехніка
|
||||
ТВО: Технології Високопродуктивних Обчислень
|
||||
ТЗІ: Технології захисту інформації
|
||||
ТЙтаМ: Теорія ймовірностей та математична # TODO: what?
|
||||
ТКП: Технології комп`ютерного проєктування
|
||||
УФМ: Українське фахове мовлення
|
||||
ФІЗ: Фізика
|
||||
ФІЛ: Філософія
|
||||
ФВС: Фізичне виховання та спорт
|
||||
ХТ: Хмарні технології
|
||||
NoSQL: NoSQL-системи
|
||||
АПЗ: Архітектура програмного забезпечення
|
||||
ВSAP: Введення до SAP-технологій
|
||||
ВМПтФ: Високорівневі мови програмування та фреймворки
|
||||
ІМпк: Іноземна мова для професійної комунікації
|
||||
ІНТ: Історія науки і техніки
|
||||
Лог: Логіка
|
||||
МППЗ: Менеджмент проектів програмного забезпечення
|
||||
МОТІ: Методи оптимізації та теорія ігр
|
||||
ОІДт: Обробка ігрових даних та звітів
|
||||
ПвІТ: Підприємництво в ІТ
|
||||
ПВJS: Поглиблене вивчення JavaScript
|
||||
ПPyt: Програмування мовою Python
|
||||
РNet: Робота з даними на платформі .Net
|
||||
РХЗ: Розробка хмарних застосувань в AZURE
|
||||
357
src/csl/dstu-3008-2015.csl
Normal file
357
src/csl/dstu-3008-2015.csl
Normal file
@@ -0,0 +1,357 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<style
|
||||
xmlns="http://purl.org/net/xbiblio/csl"
|
||||
class="in-text"
|
||||
version="1.0"
|
||||
demote-non-dropping-particle="display-and-sort"
|
||||
default-locale="uk-UA"
|
||||
>
|
||||
<info>
|
||||
<title>ДСТУ 3008:2015 (DSTU 3008:2015)</title>
|
||||
<title-short>ДСТУ 3008:2015</title-short>
|
||||
<id>dstu-3008-2015</id>
|
||||
<link
|
||||
href="https://uk.wikipedia.org/wiki/ДСТУ_3008:2015"
|
||||
rel="documentation"
|
||||
/>
|
||||
<author>
|
||||
<name>Linerds</name>
|
||||
</author>
|
||||
<category citation-format="numeric" />
|
||||
<category field="generic-base" />
|
||||
<summary
|
||||
>Український стандарт бібліографічного опису ДСТУ 3008:2015</summary>
|
||||
<updated>2024-01-01T00:00:00+00:00</updated>
|
||||
<rights
|
||||
license="http://creativecommons.org/licenses/by-sa/3.0/"
|
||||
>This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
|
||||
</info>
|
||||
|
||||
<!-- Locale definitions -->
|
||||
<locale xml:lang="uk">
|
||||
<terms>
|
||||
<term name="accessed">дата звернення</term>
|
||||
<term name="available at">URL</term>
|
||||
<term name="page" form="short">с</term>
|
||||
<term name="page" form="symbol">с</term>
|
||||
<term name="et-al">та ін.</term>
|
||||
<term name="and">,</term>
|
||||
<term name="editor" form="short">ред.</term>
|
||||
<term name="translator" form="short">пер.</term>
|
||||
<term name="edition" form="short">вид.</term>
|
||||
<term name="volume" form="short">т.</term>
|
||||
<term name="issue" form="short">вип.</term>
|
||||
<term name="number" form="short">№</term>
|
||||
</terms>
|
||||
</locale>
|
||||
|
||||
<!-- Macros -->
|
||||
|
||||
<!-- Authors/Editors macro -->
|
||||
<macro name="author">
|
||||
<names variable="author">
|
||||
<name initialize-with=". " delimiter=", " delimiter-precedes-last="never">
|
||||
<name-part name="family" text-case="capitalize-first" />
|
||||
<name-part name="given" />
|
||||
</name>
|
||||
<substitute>
|
||||
<names variable="editor">
|
||||
<name
|
||||
initialize-with=". "
|
||||
delimiter=", "
|
||||
delimiter-precedes-last="never"
|
||||
>
|
||||
<name-part name="family" text-case="capitalize-first" />
|
||||
<name-part name="given" />
|
||||
</name>
|
||||
<label form="short" prefix=" (" suffix=")" />
|
||||
</names>
|
||||
<names variable="translator">
|
||||
<name
|
||||
initialize-with=". "
|
||||
delimiter=", "
|
||||
delimiter-precedes-last="never"
|
||||
>
|
||||
<name-part name="family" text-case="capitalize-first" />
|
||||
<name-part name="given" />
|
||||
</name>
|
||||
<label form="short" prefix=" (" suffix=")" />
|
||||
</names>
|
||||
<text macro="title" />
|
||||
</substitute>
|
||||
</names>
|
||||
</macro>
|
||||
|
||||
<!-- Title macro -->
|
||||
<macro name="title">
|
||||
<choose>
|
||||
<if type="book thesis report" match="any">
|
||||
<text variable="title" font-style="italic" />
|
||||
</if>
|
||||
<else-if type="webpage post post-weblog" match="any">
|
||||
<text variable="title" />
|
||||
</else-if>
|
||||
<else>
|
||||
<text variable="title" />
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
|
||||
<!-- Publisher info -->
|
||||
<macro name="publisher">
|
||||
<group delimiter=": ">
|
||||
<text variable="publisher-place" />
|
||||
<text variable="publisher" />
|
||||
</group>
|
||||
</macro>
|
||||
|
||||
<!-- Year -->
|
||||
<macro name="year">
|
||||
<date variable="issued">
|
||||
<date-part name="year" />
|
||||
</date>
|
||||
</macro>
|
||||
|
||||
<!-- Pages -->
|
||||
<macro name="pages">
|
||||
<choose>
|
||||
<if type="book thesis report" match="any">
|
||||
<text variable="number-of-pages" />
|
||||
<text term="page" form="symbol" />
|
||||
</if>
|
||||
<else>
|
||||
<group delimiter=" ">
|
||||
<text term="page" form="short" />
|
||||
<text variable="page" />
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
|
||||
<!-- Access date and URL for web resources -->
|
||||
<macro name="access">
|
||||
<choose>
|
||||
<if type="webpage post post-weblog" match="any">
|
||||
<group delimiter=" " prefix=". ">
|
||||
<text term="available at" suffix=":" />
|
||||
<text variable="URL" />
|
||||
<group delimiter=": " prefix="(" suffix=")">
|
||||
<text term="accessed" />
|
||||
<date variable="accessed">
|
||||
<date-part name="day" form="numeric-leading-zeros" suffix="." />
|
||||
<date-part name="month" form="numeric-leading-zeros" suffix="." />
|
||||
<date-part name="year" />
|
||||
</date>
|
||||
</group>
|
||||
</group>
|
||||
</if>
|
||||
</choose>
|
||||
</macro>
|
||||
|
||||
<!-- Volume/Issue -->
|
||||
<macro name="volume-issue">
|
||||
<group delimiter=". ">
|
||||
<group delimiter=" ">
|
||||
<text term="volume" form="short" />
|
||||
<text variable="volume" />
|
||||
</group>
|
||||
<group delimiter=" ">
|
||||
<text term="issue" form="short" />
|
||||
<text variable="issue" />
|
||||
</group>
|
||||
</group>
|
||||
</macro>
|
||||
|
||||
<!-- Main citation format (numeric) -->
|
||||
<citation collapse="citation-number">
|
||||
<sort>
|
||||
<key variable="citation-number" />
|
||||
</sort>
|
||||
<layout delimiter=", " prefix="[" suffix="]">
|
||||
<text variable="citation-number" />
|
||||
</layout>
|
||||
</citation>
|
||||
|
||||
<!-- Bibliography format -->
|
||||
<bibliography hanging-indent="false">
|
||||
<sort>
|
||||
<key variable="citation-number" />
|
||||
</sort>
|
||||
<layout>
|
||||
<group display="block">
|
||||
<text display="left-margin" variable="citation-number" suffix=". " />
|
||||
|
||||
<!-- Book -->
|
||||
<choose>
|
||||
<if type="book">
|
||||
<group delimiter=". " suffix=".">
|
||||
<text macro="author" />
|
||||
<text macro="title" />
|
||||
<text macro="publisher" />
|
||||
<text macro="year" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</if>
|
||||
|
||||
<!-- Thesis -->
|
||||
<else-if type="thesis">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<text macro="title" />
|
||||
<text variable="genre" />
|
||||
<text macro="publisher" />
|
||||
<text macro="year" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Report -->
|
||||
<else-if type="report">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<text macro="title" />
|
||||
<text variable="genre" />
|
||||
<text macro="publisher" />
|
||||
<text macro="year" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Article in journal -->
|
||||
<else-if type="article-journal">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<group delimiter=" // ">
|
||||
<text variable="title" />
|
||||
<text variable="container-title" font-style="italic" />
|
||||
</group>
|
||||
<group delimiter=". ">
|
||||
<text macro="year" />
|
||||
<text macro="volume-issue" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Article in newspaper -->
|
||||
<else-if type="article-newspaper">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<group delimiter=" // ">
|
||||
<text variable="title" />
|
||||
<text variable="container-title" />
|
||||
</group>
|
||||
<group delimiter=". ">
|
||||
<date variable="issued">
|
||||
<date-part name="day" suffix="." />
|
||||
<date-part name="month" suffix="." />
|
||||
<date-part name="year" />
|
||||
</date>
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Conference paper -->
|
||||
<else-if type="paper-conference">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<text variable="title" />
|
||||
<group delimiter=" // ">
|
||||
<text term="in" />
|
||||
<text variable="container-title" />
|
||||
</group>
|
||||
<group delimiter=". ">
|
||||
<text macro="publisher" />
|
||||
<text macro="year" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Chapter in book -->
|
||||
<else-if type="chapter">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<text variable="title" />
|
||||
<group delimiter=" // ">
|
||||
<text term="in" />
|
||||
<names variable="editor">
|
||||
<name
|
||||
initialize-with=". "
|
||||
delimiter=", "
|
||||
delimiter-precedes-last="never"
|
||||
>
|
||||
<name-part name="family" text-case="capitalize-first" />
|
||||
<name-part name="given" />
|
||||
</name>
|
||||
<label form="short" prefix=" (" suffix=")" />
|
||||
</names>
|
||||
<text variable="container-title" font-style="italic" />
|
||||
</group>
|
||||
<group delimiter=". ">
|
||||
<text macro="publisher" />
|
||||
<text macro="year" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Webpage/Online -->
|
||||
<else-if type="webpage post post-weblog" match="any">
|
||||
<group delimiter=". ">
|
||||
<text variable="title" />
|
||||
<text macro="author" />
|
||||
<text variable="container-title" />
|
||||
<date variable="issued">
|
||||
<date-part name="day" suffix="." />
|
||||
<date-part name="month" suffix="." />
|
||||
<date-part name="year" />
|
||||
</date>
|
||||
</group>
|
||||
<text macro="access" suffix="." />
|
||||
</else-if>
|
||||
|
||||
<!-- Patent -->
|
||||
<else-if type="patent">
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<text variable="title" />
|
||||
<text variable="number" />
|
||||
<date variable="issued">
|
||||
<date-part name="day" suffix="." />
|
||||
<date-part name="month" suffix="." />
|
||||
<date-part name="year" />
|
||||
</date>
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Legislation -->
|
||||
<else-if type="legislation">
|
||||
<group delimiter=". ">
|
||||
<text variable="title" />
|
||||
<date variable="issued">
|
||||
<date-part name="day" suffix="." />
|
||||
<date-part name="month" suffix="." />
|
||||
<date-part name="year" />
|
||||
</date>
|
||||
<text variable="number" />
|
||||
</group>
|
||||
</else-if>
|
||||
|
||||
<!-- Generic fallback -->
|
||||
<else>
|
||||
<group delimiter=". ">
|
||||
<text macro="author" />
|
||||
<text macro="title" />
|
||||
<text variable="container-title" />
|
||||
<text macro="publisher" />
|
||||
<text macro="year" />
|
||||
<text macro="pages" />
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</group>
|
||||
</layout>
|
||||
</bibliography>
|
||||
</style>
|
||||
52
src/helpers.typ
Normal file
52
src/helpers.typ
Normal file
@@ -0,0 +1,52 @@
|
||||
/// month name from its number
|
||||
#let month-gen(month) = (
|
||||
"січня",
|
||||
"лютого",
|
||||
"березня",
|
||||
"квітня",
|
||||
"травня",
|
||||
"червня",
|
||||
"липня",
|
||||
"серпня",
|
||||
"вересня",
|
||||
"жовтня",
|
||||
"листопада",
|
||||
"грудня",
|
||||
).at(month - 1)
|
||||
|
||||
#let is-cyr(c) = regex("[\p{Cyrillic}]") in c
|
||||
|
||||
/// type-safe emptiness check
|
||||
#let is-empty(val) = {
|
||||
if val == none { return true }
|
||||
if type(val) == str { val.len() == 0 } else if type(val) == array { val == [] } else { false }
|
||||
}
|
||||
|
||||
#let degree-get(m) = if "degree" in m and not is-empty(m.degree) { [#m.degree\ ] }
|
||||
|
||||
/// returns verb form based on gender ("m", "f", or "p" for plural)
|
||||
#let gender-verb(verb, gender: "p") = {
|
||||
(
|
||||
"author": ("m": "Виконав", "f": "Виконала", "p": "Виконали"),
|
||||
"mentor": ("m": "Перевірив", "f": "Перевірила", "p": "Перевірили"),
|
||||
)
|
||||
.at(verb)
|
||||
.at(if gender == "m" or gender == "f" { gender } else { "p" })
|
||||
}
|
||||
|
||||
/// returns verb form for dictionary containing gender field
|
||||
#let gender-form(verb, dict: none) = {
|
||||
let g = if type(dict) == dictionary and "gender" in dict { dict.gender } else { "p" }
|
||||
gender-verb(verb, gender: g)
|
||||
}
|
||||
|
||||
#let pz-lb-title(type, number: none) = {
|
||||
let type-title = (
|
||||
"ЛБ": [Звіт \ з лабораторної роботи],
|
||||
"ПЗ": [Звіт \ з практичної роботи],
|
||||
"КР": [Контрольна робота],
|
||||
"РФ": [Реферат],
|
||||
"ІДЗ": [Індивідуальне домашнє завдання],
|
||||
).at(type, default: type)
|
||||
if not is-empty(number) { [#type-title №#number] } else { [#type-title] }
|
||||
}
|
||||
118
src/lib.typ
Normal file
118
src/lib.typ
Normal file
@@ -0,0 +1,118 @@
|
||||
#import "./title-pages/main.typ" as tp
|
||||
#import "./shared.typ": universities
|
||||
#import "./helpers.typ": *
|
||||
|
||||
#import "./style.typ"
|
||||
#import "./utils.typ"
|
||||
|
||||
/// Coursework template for NURE
|
||||
/// - university (str): University code, default "ХНУРЕ"
|
||||
/// - subject (str): Subject short name
|
||||
/// - title (str): Work title
|
||||
/// - authors (array): List of author dictionaries
|
||||
/// - mentors (array): List of mentor dictionaries
|
||||
/// - task-list (dict): Task metadata
|
||||
/// - calendar-plan (dict): Calendar plan table and approval date
|
||||
/// - abstract (dict): Keywords and abstract text
|
||||
/// - bib-path (str): Path to bibliography file
|
||||
/// - appendices (content): Appendix content
|
||||
#let coursework(
|
||||
doc,
|
||||
university: "ХНУРЕ",
|
||||
subject: none,
|
||||
title: none,
|
||||
authors: (),
|
||||
mentors: (),
|
||||
task-list: (),
|
||||
calendar-plan: (),
|
||||
abstract: (),
|
||||
bib-path: none,
|
||||
appendices: (),
|
||||
) = {
|
||||
set document(title: title, author: authors.map(c => c.name))
|
||||
|
||||
show: style.dstu.with(skip: 1)
|
||||
|
||||
tp.cw.nure(
|
||||
university,
|
||||
subject,
|
||||
title,
|
||||
authors,
|
||||
mentors,
|
||||
task-list,
|
||||
calendar-plan,
|
||||
abstract,
|
||||
)
|
||||
|
||||
doc
|
||||
|
||||
// Bibliography with DSTU formatting
|
||||
{
|
||||
show regex("^\\d+\\."): it => [#it#h(0.5cm)]
|
||||
show block: it => [#it.body#parbreak()]
|
||||
bibliography(bib-path, title: [Перелік джерел посилання], style: "csl/dstu-3008-2015.csl", full: true)
|
||||
}
|
||||
|
||||
style.appendices(appendices)
|
||||
}
|
||||
|
||||
/// Practice and Laboratory works template
|
||||
/// - layout (str): "default", "minimal", or "complex"
|
||||
/// - university (str): University code
|
||||
/// - edu-program (str): Education program code
|
||||
/// - subject (str): Subject code
|
||||
/// - type (str): Work type (ЛБ, ПЗ, КР, РФ, ІДЗ)
|
||||
/// - number (int): Work number
|
||||
/// - title (str): Work title
|
||||
/// - authors (array): List of authors
|
||||
/// - mentors (array): List of mentors
|
||||
#let pz-lb(
|
||||
doc,
|
||||
layout: "default",
|
||||
university: "ХНУРЕ",
|
||||
edu-program: none,
|
||||
subject: none,
|
||||
type: none,
|
||||
number: none,
|
||||
title: none,
|
||||
authors: (),
|
||||
mentors: (),
|
||||
skip-heading: false,
|
||||
) = {
|
||||
assert(authors.len() > 0, message: "At least one author required")
|
||||
|
||||
let edu-program = if edu-program != none { edu-program } else { authors.first().edu-program }
|
||||
let uni = universities.at(university)
|
||||
|
||||
set document(title: title, author: authors.map(c => c.name))
|
||||
|
||||
show: style.dstu.with(skip: 1)
|
||||
|
||||
// Select layout variant
|
||||
let layouts = (
|
||||
"complex": () => tp.pz-lb.complex(uni, edu-program, subject, type, number, title, authors, mentors),
|
||||
"ХНУРЕ": () => tp.pz-lb.nure(uni, edu-program, subject, type, number, title, authors, mentors),
|
||||
"default": () => tp.pz-lb.nure(uni, edu-program, subject, type, number, title, authors, mentors),
|
||||
)
|
||||
|
||||
(layouts.at(university, default: layouts.default))()
|
||||
|
||||
if not skip-heading {
|
||||
pagebreak(weak: true)
|
||||
|
||||
// Set heading counter based on title/number
|
||||
if title == none {
|
||||
if number == none { context counter(heading).update(1) } else {
|
||||
context counter(heading).update(number)
|
||||
}
|
||||
} else {
|
||||
if number != none {
|
||||
context counter(heading).update(number - 1)
|
||||
}
|
||||
|
||||
heading(eval(title, mode: "markup"))
|
||||
}
|
||||
}
|
||||
|
||||
doc
|
||||
}
|
||||
1
src/shared.typ
Normal file
1
src/shared.typ
Normal file
@@ -0,0 +1 @@
|
||||
#let universities = yaml("config/universities.yaml")
|
||||
136
src/style.typ
Normal file
136
src/style.typ
Normal file
@@ -0,0 +1,136 @@
|
||||
#import "utils.typ": bold
|
||||
/// Constants for consistent styling
|
||||
#let spacing = 0.95em
|
||||
#let indent-size = 1.25cm
|
||||
#let double-spacing = spacing * 2
|
||||
#let double-half-spacing = spacing * 2.5
|
||||
|
||||
/// Ukrainian alphabet for DSTU 3008:2015 numbering
|
||||
#let ukr-enum = "абвгдежиклмнпрстуфхцшщюя".clusters()
|
||||
|
||||
/// Helper for level 2/3 heading blocks
|
||||
#let heading-block(it, num: auto) = {
|
||||
v(double-spacing, weak: true)
|
||||
block(width: 100%, spacing: 0em)[
|
||||
#h(indent-size)
|
||||
#counter(heading).display(num)
|
||||
#it.body
|
||||
]
|
||||
v(double-spacing, weak: true)
|
||||
}
|
||||
|
||||
/// DSTU 3008:2015 Style
|
||||
#let dstu(
|
||||
it,
|
||||
skip: 0,
|
||||
offset: 0,
|
||||
) = {
|
||||
// Page setup
|
||||
set page(
|
||||
paper: "a4",
|
||||
number-align: top + right,
|
||||
margin: (top: 20mm, right: 10mm, bottom: 20mm, left: 25mm),
|
||||
numbering: (i, ..) => if i > skip { numbering("1", i + offset) },
|
||||
)
|
||||
|
||||
// Text and paragraph
|
||||
set text(lang: "uk", size: 14pt, hyphenate: false, font: ("Times New Roman", "Liberation Serif"))
|
||||
set par(justify: true, spacing: spacing, leading: spacing, first-line-indent: (amount: indent-size, all: true))
|
||||
set block(spacing: spacing)
|
||||
set underline(evade: false)
|
||||
|
||||
// Lists
|
||||
set enum(indent: indent-size, body-indent: 0.5cm, numbering: i => ukr-enum.at(i - 1) + ")")
|
||||
show enum: it => {
|
||||
set enum(indent: 0em, numbering: "1)")
|
||||
it
|
||||
}
|
||||
set list(indent: indent-size + 0.1cm, body-indent: 0.5cm, marker: [--])
|
||||
|
||||
// Figures
|
||||
show figure: it => {
|
||||
v(double-spacing, weak: true)
|
||||
it
|
||||
v(double-spacing, weak: true)
|
||||
}
|
||||
set figure.caption(separator: [ -- ])
|
||||
show figure.where(kind: table): set figure.caption(position: top)
|
||||
show figure.caption.where(kind: table): set align(left)
|
||||
show figure.where(kind: raw): set figure.caption(position: top)
|
||||
show figure.where(kind: raw): set align(left)
|
||||
|
||||
// Numbering reset on level 1 headings
|
||||
show heading.where(level: 1): it => {
|
||||
counter(math.equation).update(0)
|
||||
counter(figure.where(kind: raw)).update(0)
|
||||
counter(figure.where(kind: image)).update(0)
|
||||
counter(figure.where(kind: table)).update(0)
|
||||
it
|
||||
}
|
||||
set figure(numbering: i => context numbering("1.1", counter(heading).get().at(0), i))
|
||||
set math.equation(numbering: i => context numbering("(1.1)", counter(heading).get().at(0), i))
|
||||
|
||||
// Headings
|
||||
set heading(numbering: "1.1")
|
||||
show heading: it => {
|
||||
set text(size: 14pt)
|
||||
if it.level == 1 {
|
||||
set align(center)
|
||||
set text(weight: "semibold")
|
||||
pagebreak(weak: true)
|
||||
upper(it)
|
||||
v(double-spacing, weak: true)
|
||||
} else {
|
||||
set text(weight: "regular")
|
||||
heading-block(it, num: if it.level == 3 { it.numbering } else { auto })
|
||||
}
|
||||
}
|
||||
|
||||
// Code listings
|
||||
show raw.where(block: true): it => {
|
||||
let code-spacing = 0.5em
|
||||
set block(spacing: code-spacing)
|
||||
set par(spacing: code-spacing, leading: code-spacing)
|
||||
set text(size: 11pt, weight: "semibold", font: ("Courier New", "Liberation Mono"))
|
||||
v(double-half-spacing, weak: true)
|
||||
pad(it, left: indent-size)
|
||||
v(double-half-spacing, weak: true)
|
||||
}
|
||||
|
||||
it
|
||||
}
|
||||
|
||||
/// DSTU 3008:2015 Appendices Style
|
||||
#let appendices(it) = {
|
||||
counter(heading).update(0)
|
||||
|
||||
set heading(numbering: (i, ..n) => upper(ukr-enum.at(i - 1)) + numbering(".1.1", ..n))
|
||||
set heading(supplement: [Додаток])
|
||||
|
||||
let app-letter = context upper(ukr-enum.at(counter(heading).get().at(0) - 1))
|
||||
set figure(numbering: i => app-letter + "." + str(i))
|
||||
set math.equation(numbering: i => [(#app-letter.#str(i))])
|
||||
|
||||
show heading: h => {
|
||||
set text(size: 14pt)
|
||||
if h.level == 1 {
|
||||
counter(math.equation).update(0)
|
||||
counter(figure.where(kind: raw)).update(0)
|
||||
counter(figure.where(kind: image)).update(0)
|
||||
counter(figure.where(kind: table)).update(0)
|
||||
|
||||
set align(center)
|
||||
set text(weight: "regular")
|
||||
pagebreak(weak: true)
|
||||
bold([ДОДАТОК #counter(heading).display(auto)])
|
||||
linebreak()
|
||||
h.body
|
||||
v(double-spacing, weak: true)
|
||||
} else {
|
||||
set text(weight: "regular")
|
||||
heading-block(h)
|
||||
}
|
||||
}
|
||||
|
||||
it
|
||||
}
|
||||
1
src/title-pages/coursework/main.typ
Normal file
1
src/title-pages/coursework/main.typ
Normal file
@@ -0,0 +1 @@
|
||||
#import "nure.typ": *
|
||||
254
src/title-pages/coursework/nure.typ
Normal file
254
src/title-pages/coursework/nure.typ
Normal file
@@ -0,0 +1,254 @@
|
||||
#import "../../shared.typ": universities
|
||||
#import "../../helpers.typ": *
|
||||
#import "../../style.typ": *
|
||||
#import "../../utils.typ": bold, hfill, uline
|
||||
|
||||
#let nure(
|
||||
university,
|
||||
subject,
|
||||
title,
|
||||
authors,
|
||||
mentors,
|
||||
task-list,
|
||||
calendar-plan,
|
||||
abstract,
|
||||
) = {
|
||||
let bib-count = state("citation-counter", ())
|
||||
show cite: it => {
|
||||
it
|
||||
bib-count.update(((..c)) => (..c, it.key))
|
||||
}
|
||||
|
||||
let author = authors.first()
|
||||
let head-mentor = mentors.first()
|
||||
|
||||
let uni = universities.at(university)
|
||||
let edu-prog = uni.edu-programs.at(author.edu-program)
|
||||
|
||||
// page 1 {{{2
|
||||
[
|
||||
#set align(center)
|
||||
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ\
|
||||
#upper(uni.name)
|
||||
|
||||
\
|
||||
|
||||
Кафедра #edu-prog.department-gen
|
||||
|
||||
\
|
||||
|
||||
ПОЯСНЮВАЛЬНА ЗАПИСКА\
|
||||
ДО КУРСОВОЇ РОБОТИ\
|
||||
з дисципліни: "#uni.subjects.at(subject, default: subject)"\
|
||||
Тема роботи: "#title"
|
||||
|
||||
\ \ \
|
||||
|
||||
#columns(2, gutter: 4cm)[
|
||||
#set align(left)
|
||||
#set par(first-line-indent: 0pt)
|
||||
|
||||
#gender-form("author", dict: author) ст. гр. #author.edu-program\-#author.group
|
||||
|
||||
\
|
||||
Керівник:\ #head-mentor.degree
|
||||
|
||||
\
|
||||
Робота захищена на оцінку
|
||||
|
||||
\
|
||||
Комісія:\ #for m in mentors { degree-get(m) }
|
||||
|
||||
#colbreak()
|
||||
#set align(left)
|
||||
|
||||
|
||||
#author.name
|
||||
|
||||
\ \
|
||||
#head-mentor.name
|
||||
|
||||
\
|
||||
#underline(" " * 35)
|
||||
|
||||
\ \
|
||||
#for m in mentors [#m.name\ ]
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
Харків -- #task-list.done-date.display("[year]")
|
||||
|
||||
#pagebreak()
|
||||
]
|
||||
|
||||
// page 2 {{{2
|
||||
{
|
||||
uline[#uni.name]
|
||||
|
||||
linebreak()
|
||||
linebreak()
|
||||
|
||||
grid(
|
||||
columns: (100pt, 1fr),
|
||||
bold[
|
||||
Кафедра
|
||||
Дисципліна
|
||||
Спеціальність
|
||||
],
|
||||
{
|
||||
uline(align: left, edu-prog.department-gen)
|
||||
linebreak()
|
||||
uline(align: left, uni.subjects.at(subject, default: subject))
|
||||
linebreak()
|
||||
uline(align: left, [#edu-prog.code #edu-prog.name-long])
|
||||
},
|
||||
)
|
||||
grid(
|
||||
columns: (1fr, 1fr, 1fr),
|
||||
gutter: 0.3fr,
|
||||
[#bold[Курс] #uline(author.course)],
|
||||
[#bold[Група] #uline([#author.edu-program\-#author.group])],
|
||||
[#bold[Семестр] #uline(author.semester)],
|
||||
)
|
||||
|
||||
linebreak()
|
||||
linebreak()
|
||||
linebreak()
|
||||
|
||||
align(center, bold[ЗАВДАННЯ \ на курсову роботу студента])
|
||||
|
||||
linebreak()
|
||||
|
||||
uline(align: left)[_#author.full-name-gen _]
|
||||
|
||||
linebreak()
|
||||
linebreak()
|
||||
|
||||
bold[\1. Тема роботи:]
|
||||
uline[#title.]
|
||||
|
||||
linebreak()
|
||||
|
||||
{
|
||||
bold[\2. Строк здачі закінченої роботи:]
|
||||
uline(task-list.done-date.display("[day].[month].[year]"))
|
||||
hfill(10fr)
|
||||
}
|
||||
|
||||
linebreak()
|
||||
|
||||
bold[\3. Вихідні дані для роботи:]
|
||||
uline(task-list.source)
|
||||
|
||||
linebreak()
|
||||
|
||||
bold[\4. Зміст розрахунково-пояснювальної записки:]
|
||||
uline(task-list.content)
|
||||
|
||||
linebreak()
|
||||
|
||||
bold[\5. Перелік графічного матеріалу:]
|
||||
uline(task-list.graphics)
|
||||
|
||||
linebreak()
|
||||
|
||||
{
|
||||
bold[\6. Дата видачі завдання:]
|
||||
uline(task-list.initial-date.display("[day].[month].[year]"))
|
||||
hfill(10fr)
|
||||
}
|
||||
|
||||
pagebreak()
|
||||
}
|
||||
|
||||
// page 3 {{{2
|
||||
{
|
||||
align(center, bold[КАЛЕНДАРНИЙ ПЛАН])
|
||||
set par(first-line-indent: 0pt)
|
||||
|
||||
linebreak()
|
||||
|
||||
calendar-plan.plan-table
|
||||
|
||||
linebreak()
|
||||
|
||||
grid(
|
||||
columns: (5fr, 5fr),
|
||||
grid(
|
||||
columns: (1fr, 2fr, 1fr),
|
||||
gutter: 0.2fr,
|
||||
[
|
||||
Студент \
|
||||
Керівник \
|
||||
#align(center)["#underline[#calendar-plan.approval-date.day()]"]
|
||||
],
|
||||
[
|
||||
#uline(align: center, []) \
|
||||
#uline(align: center, []) \
|
||||
#uline(align: center, month-gen(calendar-plan.approval-date.month()))
|
||||
],
|
||||
[
|
||||
\ \
|
||||
#underline[#calendar-plan.approval-date.year()] р.
|
||||
],
|
||||
),
|
||||
[
|
||||
#author.name, \
|
||||
#head-mentor.degree
|
||||
#head-mentor.name.
|
||||
],
|
||||
)
|
||||
|
||||
pagebreak()
|
||||
}
|
||||
|
||||
// page 4 {{{2
|
||||
[
|
||||
#align(center, bold[РЕФЕРАТ]) \
|
||||
|
||||
#context [
|
||||
#let pages = counter(page).final().at(0)
|
||||
#let images = query(figure.where(kind: image)).len()
|
||||
#let tables = query(figure.where(kind: table)).len()
|
||||
#let bibs = bib-count.final().dedup().len()
|
||||
/* TODO: why this stopped working?
|
||||
#let tables = counter(figure.where(kind: table)).final().at(0)
|
||||
#let images = counter(figure.where(kind: image)).final().at(0)*/
|
||||
|
||||
#let counters = ()
|
||||
|
||||
#if pages != 0 { counters.push[#pages с.] }
|
||||
#if tables != 0 { counters.push[#tables табл.] }
|
||||
#if images != 0 { counters.push[#images рис.] }
|
||||
#if bibs != 0 { counters.push[#bibs джерел] }
|
||||
|
||||
Пояснювальна записка до курсової роботи: #counters.join(", ").
|
||||
]
|
||||
|
||||
\
|
||||
|
||||
#(
|
||||
abstract
|
||||
.keywords
|
||||
.map(upper)
|
||||
.sorted(by: (a, b) => {
|
||||
if is-cyr(a) != is-cyr(b) { true } else { a < b }
|
||||
})
|
||||
.join(", ")
|
||||
)
|
||||
|
||||
\
|
||||
#abstract.text
|
||||
]
|
||||
|
||||
// page 5 {{{2
|
||||
outline(
|
||||
title: [
|
||||
ЗМІСТ
|
||||
#v(spacing * 2, weak: true)
|
||||
],
|
||||
depth: 2,
|
||||
indent: auto,
|
||||
)
|
||||
}
|
||||
2
src/title-pages/main.typ
Normal file
2
src/title-pages/main.typ
Normal file
@@ -0,0 +1,2 @@
|
||||
#import "pz-lb/main.typ" as pz-lb
|
||||
#import "coursework/main.typ" as cw
|
||||
60
src/title-pages/pz-lb/complex.typ
Normal file
60
src/title-pages/pz-lb/complex.typ
Normal file
@@ -0,0 +1,60 @@
|
||||
#import "../../helpers.typ": *
|
||||
#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", dict: a):\
|
||||
студент групи #a.edu-program\-#a.group\ #a.name\ ]
|
||||
text(size: 8pt, [(прізвище та ініціали)\ ])
|
||||
} else if authors.len() > 1 [
|
||||
#gender-verb("author"):\
|
||||
#for a in authors [студент групи #a.edu-program\-#a.group\ #a.name\ ]
|
||||
#text(size: 8pt, [(прізвище та ініціали)\ ])
|
||||
]
|
||||
|
||||
\
|
||||
|
||||
#if mentors.len() == 1 {
|
||||
let m = mentors.first()
|
||||
[#gender-form("mentor", dict: m):\ ]
|
||||
degree-get(m)
|
||||
[#m.name\ ]
|
||||
text(size: 8pt, [(прізвище та ініціали)\ ])
|
||||
} else if mentors.len() > 1 [
|
||||
#gender-verb("mentor"):\
|
||||
#for m in mentors {
|
||||
degree-get(m)
|
||||
[#m.name\ ]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
Харків\
|
||||
#datetime.today().display("[year]")
|
||||
]
|
||||
}
|
||||
2
src/title-pages/pz-lb/main.typ
Normal file
2
src/title-pages/pz-lb/main.typ
Normal file
@@ -0,0 +1,2 @@
|
||||
#import "complex.typ": *
|
||||
#import "nure.typ": *
|
||||
52
src/title-pages/pz-lb/nure.typ
Normal file
52
src/title-pages/pz-lb/nure.typ
Normal file
@@ -0,0 +1,52 @@
|
||||
#import "../../helpers.typ": *
|
||||
#let nure(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")"]
|
||||
|
||||
\ \ \ \
|
||||
#columns(2)[
|
||||
#set align(left)
|
||||
#set par(first-line-indent: 0pt)
|
||||
|
||||
#if authors.len() == 1 {
|
||||
let a = authors.first()
|
||||
[#gender-form("author", dict: a):\ ]
|
||||
[ст. гр. #a.edu-program\-#a.group\ ]
|
||||
[#a.name\ ]
|
||||
if not is-empty(a.variant) [Варіант: №#a.variant]
|
||||
} else if authors.len() > 1 [
|
||||
#gender-form("author"):\
|
||||
#for a in authors [ст. гр. #a.edu-program\-#a.group\ #a.name\ ]
|
||||
]
|
||||
|
||||
#colbreak()
|
||||
#set align(right)
|
||||
|
||||
#if mentors.len() == 1 {
|
||||
let m = mentors.first()
|
||||
[#gender-form("mentor", dict: m):\ ]
|
||||
degree-get(m)
|
||||
[#m.name\ ]
|
||||
} else if mentors.len() > 1 [
|
||||
#gender-form("mentor"):\
|
||||
#for m in mentors {
|
||||
degree-get(m)
|
||||
[#m.name\ ]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
Харків -- #datetime.today().display("[year]")
|
||||
]
|
||||
}
|
||||
56
src/utils.typ
Normal file
56
src/utils.typ
Normal file
@@ -0,0 +1,56 @@
|
||||
/// bold text
|
||||
#let bold(content) = text(weight: "bold")[#content]
|
||||
|
||||
/// numberless heading
|
||||
#let nheading(title) = heading(depth: 1, numbering: none, title)
|
||||
|
||||
/// fill horizontal space with a filled box
|
||||
#let hfill(width) = box(width: width, repeat(" ")) // HAIR SPACE (U+200A)
|
||||
|
||||
/// underlined cell with centered content by default
|
||||
#let uline(align: center, content) = underline[
|
||||
#if align != left { hfill(1fr) }
|
||||
#content
|
||||
#if align != right { hfill(1fr) }
|
||||
]
|
||||
|
||||
/// Extract filename stem without extension
|
||||
#let stem(path) = path.split("/").last().split(".").first()
|
||||
|
||||
/// Extract parent directory name
|
||||
#let parent-dir(path) = path.split("/").at(-2, default: "")
|
||||
|
||||
/// Generate label from image path:
|
||||
/// - "image.png" → "image"
|
||||
/// - "img/foo/bar.png" → "foo_bar"
|
||||
#let img-label(path) = {
|
||||
let name = stem(path)
|
||||
let parent = parent-dir(path)
|
||||
|
||||
// If parent exists and name doesn't start with parent name, combine them
|
||||
let base = if parent != "" and not name.starts-with(parent) {
|
||||
parent + "_" + name
|
||||
} else {
|
||||
name
|
||||
}
|
||||
|
||||
label(base.replace(" ", "_"))
|
||||
}
|
||||
|
||||
/// Format image caption based on optional source
|
||||
#let img-caption(base-caption, source) = {
|
||||
if source == none {
|
||||
base-caption + " (рисунок виконано самостійно)"
|
||||
} else if source == () or source == "" {
|
||||
base-caption
|
||||
} else {
|
||||
base-caption + " (за даними " + source + ")"
|
||||
}
|
||||
}
|
||||
|
||||
/// captioned image with auto-generated label from path
|
||||
/// Usage: img("path/to/image.png", "Caption")(optional: "source")
|
||||
#let img(path, caption, ..sink) = {
|
||||
let source = sink.pos().at(0, default: ())
|
||||
[ #figure(image(path, ..sink.named()), caption: utils.img-caption(caption, source)) #utils.img-label(path) ]
|
||||
}
|
||||
@@ -6,7 +6,6 @@ go:
|
||||
value: https://go.dev/
|
||||
date: 2024-12-10
|
||||
|
||||
|
||||
htmx:
|
||||
type: Web
|
||||
title: Htmx - high power tools for html
|
||||
@@ -1,59 +1,60 @@
|
||||
#import "@local/nure:0.0.0": *
|
||||
#import "@local/nure:0.1.1": *
|
||||
#import style: spacing
|
||||
|
||||
#let author = (
|
||||
name: "Ситник Є. С.",
|
||||
full_name_gen: "Ситника Єгора Сергійовича",
|
||||
variant: 13,
|
||||
group: "ПЗПІ-23-2",
|
||||
gender: "m",
|
||||
#import "utils.typ": img
|
||||
|
||||
#let authors = (
|
||||
(
|
||||
name: "Ситник Є. С.",
|
||||
full-name-gen: "Ситника Єгора Сергійовича",
|
||||
edu-program: "ПЗПІ",
|
||||
group: "23-2",
|
||||
gender: "m",
|
||||
course: 2,
|
||||
semester: 3,
|
||||
variant: 13,
|
||||
),
|
||||
)
|
||||
|
||||
#let mentors = (
|
||||
(
|
||||
name: "Черепанова Ю. Ю.",
|
||||
gender: "f",
|
||||
degree: "Ст. викл. каф. ПІ",
|
||||
),
|
||||
(
|
||||
name: "Русакова Н. Є.",
|
||||
gender: "f",
|
||||
degree: "Доц. каф. ПІ",
|
||||
),
|
||||
(
|
||||
name: "Широкопетлєва М. С.",
|
||||
gender: "f",
|
||||
degree: "Ст. викл. каф. ПІ",
|
||||
),
|
||||
(name: "Черепанова Ю. Ю.", degree: "Ст. викл. каф. ПІ"),
|
||||
(name: "Русакова Н. Є.", degree: "Доц. каф. ПІ"),
|
||||
(name: "Широкопетлєва М. С.", degree: "Ст. викл. каф. ПІ"),
|
||||
)
|
||||
|
||||
#let task_list = (
|
||||
done_date: datetime(year: 2024, month: 12, day: 27),
|
||||
initial_date: datetime(year: 2024, month: 9, day: 15),
|
||||
#let task-list = (
|
||||
done-date: datetime(year: 2024, month: 12, day: 27),
|
||||
initial-date: datetime(year: 2024, month: 9, day: 15),
|
||||
source: "методичні вказівки до виконання курсової роботи, вимоги до інформаційної системи, предметна область, що пов’язана з управлінням класом та класним керівництвом.",
|
||||
content: "вступ, аналіз предметної області; постановка задачі; проектування бази даних; опис програми; висновки; перелік джерел посилання.",
|
||||
graphics: "загальна діаграма класів, ER-діаграма, UML-діаграми, DFD-діаграма, схема БД в 1НФ, 2НФ, 3НФ, копії екранів (“скриншоти”) прикладної програми, приклади звітів прикладної програми.",
|
||||
)
|
||||
|
||||
#let calendar_plan = (
|
||||
plan_table: table(
|
||||
#let calendar-plan = (
|
||||
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], [Виконано],
|
||||
|
||||
[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], [Виконано],
|
||||
|
||||
[9], [Друга контрольна точка з курсової роботи], [7.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),
|
||||
approval-date: datetime(year: 2024, month: 12, day: 27),
|
||||
)
|
||||
|
||||
#let abstract = (
|
||||
@@ -69,11 +70,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, легко
|
||||
адаптується під потреби користувача.
|
||||
],
|
||||
)
|
||||
|
||||
@@ -82,7 +98,7 @@
|
||||
#v(-spacing)
|
||||
== Частина 1
|
||||
#lorem(100)
|
||||
== Частина2
|
||||
== Частина 2
|
||||
#lorem(200)
|
||||
|
||||
= Приклад звіту 2
|
||||
@@ -92,17 +108,15 @@
|
||||
#lorem(200)
|
||||
]
|
||||
|
||||
#show: cw-template.with(
|
||||
#show: coursework.with(
|
||||
title: "Інформаційна система «Помічник класного керівника». Керування класом",
|
||||
subject_shorthand: "БД",
|
||||
department_gen: "Програмної інженерії",
|
||||
edu_program_shorthand: "ПЗПІ",
|
||||
author: author,
|
||||
subject: "БД",
|
||||
authors: authors,
|
||||
mentors: mentors,
|
||||
task_list: task_list,
|
||||
calendar_plan: calendar_plan,
|
||||
task-list: task-list,
|
||||
calendar-plan: calendar-plan,
|
||||
abstract: abstract,
|
||||
bib_path: "bibl.yml",
|
||||
bib-path: bytes(read("bibl.yml")), // NOTE: use `bytes("bibl.yml")` as typst looks in template dir when using just filename
|
||||
appendices: appendices,
|
||||
)
|
||||
|
||||
78
template/default/lab.typ
Normal file
78
template/default/lab.typ
Normal file
@@ -0,0 +1,78 @@
|
||||
#import "@local/nure:0.1.1": *
|
||||
#import "utils.typ": img
|
||||
|
||||
#import style: spacing
|
||||
|
||||
#show: pz-lb.with(
|
||||
university: "ХНУРЕ",
|
||||
subject: "СМП",
|
||||
type: "ЛБ",
|
||||
number: 2,
|
||||
title: "Потiк керування та алгоритмічні структури Bash",
|
||||
mentors: (
|
||||
(name: "Шевченко Т. Г.", degree: "Доцент кафедри ПІ", gender: "m"),
|
||||
(name: "Франко І. Я.", degree: "Асистент кафедри ПІ", gender: "m"),
|
||||
),
|
||||
authors: (
|
||||
(
|
||||
name: "Косач Л. П.",
|
||||
full-name-gen: "Косач Лариси Петрівни",
|
||||
edu-program: "КУІБ",
|
||||
group: "23-2",
|
||||
gender: "f",
|
||||
course: 2,
|
||||
semester: 4,
|
||||
variant: 8,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
#v(-spacing)
|
||||
|
||||
== Мета роботи
|
||||
#lorem(100)
|
||||
|
||||
== Хід роботи
|
||||
#v(-spacing)
|
||||
=== Підготовка
|
||||
#lorem(150)
|
||||
|
||||
=== Виконання дослідження
|
||||
#lorem(300)
|
||||
|
||||
=== Підрахунок результатів
|
||||
#lorem(250)
|
||||
|
||||
== Висновки
|
||||
#lorem(100)
|
||||
|
||||
== Контрольні запитання
|
||||
#lorem(100):
|
||||
- #lorem(20);
|
||||
- #lorem(30);
|
||||
- #lorem(15);
|
||||
- #lorem(25);
|
||||
- #lorem(42);
|
||||
- #lorem(27).
|
||||
|
||||
#show: style.appendices
|
||||
|
||||
= Quote
|
||||
#link("https://youtu.be/bJQj1uKtnus")[
|
||||
The art isn't the art, the art is never the art,
|
||||
the art is the thing that happens inside you when you make it and the feeling in the heart of the beholder.
|
||||
]
|
||||
|
||||
|
||||
= Приклад звіту 1
|
||||
#v(-spacing)
|
||||
== Частина 1
|
||||
#lorem(100)
|
||||
== Частина 2
|
||||
#lorem(200)
|
||||
|
||||
= Приклад звіту 2
|
||||
#lorem(200)
|
||||
|
||||
= Приклад звіту 3
|
||||
#lorem(200)
|
||||
7
template/default/utils.typ
Normal file
7
template/default/utils.typ
Normal file
@@ -0,0 +1,7 @@
|
||||
#import "@local/nure:0.1.1": utils
|
||||
/// captioned image with auto-generated label from path
|
||||
/// Usage: img("path/to/image.png", "Caption")(optional: "source")
|
||||
#let img(path, caption, ..sink) = {
|
||||
let source = sink.pos().at(0, default: ())
|
||||
[ #figure(image(path, ..sink.named()), caption: utils.img-caption(caption, source)) #utils.img-label(path) ]
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#import "@local/nure:0.0.0": *
|
||||
|
||||
#show: lab-pz-template.with(
|
||||
doctype: "ЛБ",
|
||||
title: "Інформаційна система «Помічник класного керівника». Керування класом",
|
||||
subject_shorthand: "БД",
|
||||
department_gen: "Програмної інженерії",
|
||||
authors: (
|
||||
(
|
||||
name: "Ситник Є. С.",
|
||||
full_name_gen: "Ситника Єгора Сергійовича",
|
||||
variant: 13,
|
||||
group: "ПЗПІ-23-2",
|
||||
gender: "m",
|
||||
),
|
||||
),
|
||||
mentor: (
|
||||
name: "Черепанова Ю. Ю.",
|
||||
gender: "f",
|
||||
degree: "Ст. викл. каф. ПІ",
|
||||
),
|
||||
worknumber: 1,
|
||||
)
|
||||
|
||||
#v(-spacing)
|
||||
|
||||
== Мета роботи
|
||||
#lorem(100)
|
||||
|
||||
== Хід роботи
|
||||
#v(-spacing)
|
||||
=== Підготовка
|
||||
#lorem(150)
|
||||
|
||||
=== Виконання дослідження
|
||||
#lorem(300)
|
||||
|
||||
=== Підрахунок результатів
|
||||
#lorem(250)
|
||||
|
||||
== Висновки
|
||||
#lorem(100)
|
||||
|
||||
== Контрольні запитання
|
||||
#lorem(100):
|
||||
- #lorem(20);
|
||||
- #lorem(30);
|
||||
- #lorem(15);
|
||||
- #lorem(25);
|
||||
- #lorem(42);
|
||||
- #lorem(27).
|
||||
64
template/unexplrd-mise/.mise/config.toml
Normal file
64
template/unexplrd-mise/.mise/config.toml
Normal file
@@ -0,0 +1,64 @@
|
||||
[settings]
|
||||
quiet = true
|
||||
env_shell_expand = true
|
||||
lockfile = true
|
||||
|
||||
[tools]
|
||||
typst = "latest"
|
||||
typstyle = "latest"
|
||||
tinymist = "latest"
|
||||
yq = "latest"
|
||||
|
||||
[vars]
|
||||
vendor_dir = "{{config_root}}/vendor"
|
||||
package_dir = "{{vars.vendor_dir}}/typst-packages"
|
||||
|
||||
work_doc_config = "src/doc.toml"
|
||||
work_input_file = "src/main.typ"
|
||||
work_output_file = "{{config_root}}/main.pdf"
|
||||
|
||||
nure_package_repo = "https://gitea.linerds.us/pencelheimer/typst_nure_template.git"
|
||||
nure_package_ref = "0.1.1"
|
||||
nure_package_rev = "af2ba45a16f94b37cae9db0f8fdb915db545498d"
|
||||
|
||||
nure_package_name = "vendor/nure"
|
||||
nure_package_ver = "{{vars.nure_package_ref}}"
|
||||
|
||||
nure_package_path = "{{vars.package_dir}}/{{vars.nure_package_name}}/{{vars.nure_package_ver}}"
|
||||
|
||||
[env]
|
||||
TYPST_PACKAGE_DIR = "{{vars.package_dir}}"
|
||||
TYPST_PACKAGE_PATH = "$TYPST_PACKAGE_DIR"
|
||||
|
||||
[tasks]
|
||||
compile.depends = ["fetch-nure-package"]
|
||||
watch.depends = ["fetch-nure-package"]
|
||||
compile.run = "mise exec -- typst compile {{vars.work_input_file}} {{vars.work_output_file}}"
|
||||
watch.run = "mise exec -- typst watch {{vars.work_input_file}} {{vars.work_output_file}}"
|
||||
format.run = "mise exec -- typstyle -l 120 -i $MISE_PROJECT_ROOT/src"
|
||||
clean.run = "rm -rvif *.pdf"
|
||||
|
||||
update-package-rev.run = "mise config set vars.nure_package_rev $(git ls-remote {{vars.nure_package_repo}} refs/heads/{{vars.nure_package_ref}} | cut -f1)"
|
||||
|
||||
[tasks.fetch-nure-package]
|
||||
silent = "stdout"
|
||||
run = """
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -d {{vars.nure_package_path}}/.git ]; then
|
||||
git clone --depth 1 --revision {{vars.nure_package_rev}} {{vars.nure_package_repo}} {{vars.nure_package_path}}
|
||||
else
|
||||
git -C {{vars.nure_package_path}} fetch --depth 1 origin {{vars.nure_package_rev}}
|
||||
git -C {{vars.nure_package_path}} checkout {{vars.nure_package_rev}}
|
||||
fi
|
||||
"""
|
||||
|
||||
[tasks.copy]
|
||||
depends = ["compile"]
|
||||
run = """
|
||||
#!/usr/bin/env bash
|
||||
|
||||
final_name=$(mise exec -- yq '.type + (.number | tostring) + "_" + (.authors[0].name | split(" "))[0] + "_" + (.authors[0].edu-program + "-" + .authors[0].group) + "_" + .subject + ".pdf"' "{{vars.work_doc_config}}");
|
||||
|
||||
cp -v "{{vars.work_output_file}}" "$final_name"
|
||||
"""
|
||||
35
template/unexplrd-mise/.mise/mise.lock
Normal file
35
template/unexplrd-mise/.mise/mise.lock
Normal file
@@ -0,0 +1,35 @@
|
||||
[[tools.tinymist]]
|
||||
version = "0.14.14"
|
||||
backend = "aqua:Myriad-Dreamin/tinymist"
|
||||
"platforms.linux-arm64" = { checksum = "sha256:39eb99d290fd1aa0e4508e5d5bbbf5a49648cf26da8e7bc3ff49f75c5fd0dc6c", url = "https://github.com/Myriad-Dreamin/tinymist/releases/download/v0.14.14/tinymist-linux-arm64"}
|
||||
"platforms.linux-x64" = { checksum = "sha256:cda2ba76a455f3577cf2a1bd6340b75491f0c673770f631cf4d3232663860776", url = "https://github.com/Myriad-Dreamin/tinymist/releases/download/v0.14.14/tinymist-linux-x64"}
|
||||
"platforms.macos-arm64" = { checksum = "sha256:ea7a22af0d54a71fbd1ee6c8c9f8434b521549926ae0f53a82391adeea741aba", url = "https://github.com/Myriad-Dreamin/tinymist/releases/download/v0.14.14/tinymist-darwin-arm64"}
|
||||
"platforms.macos-x64" = { checksum = "sha256:f640889414d5030de1f03b966ccb10a84941bc1176980ff956d66714508ccd85", url = "https://github.com/Myriad-Dreamin/tinymist/releases/download/v0.14.14/tinymist-darwin-x64"}
|
||||
"platforms.windows-x64" = { checksum = "sha256:3d39c7b417287d8689c69159b65fbc62427e141b9489500ad81039ee783f2549", url = "https://github.com/Myriad-Dreamin/tinymist/releases/download/v0.14.14/tinymist-win32-x64.exe"}
|
||||
|
||||
[[tools.typst]]
|
||||
version = "0.14.2"
|
||||
backend = "aqua:typst/typst"
|
||||
"platforms.linux-arm64" = { checksum = "sha256:491b101aa40a3a7ea82a3f8a6232cabb4e6a7e233810082e5ac812d43fdcd47a", url = "https://github.com/typst/typst/releases/download/v0.14.2/typst-aarch64-unknown-linux-musl.tar.xz"}
|
||||
"platforms.linux-x64" = { checksum = "sha256:a6044cbad2a954deb921167e257e120ac0a16b20339ec01121194ff9d394996d", url = "https://github.com/typst/typst/releases/download/v0.14.2/typst-x86_64-unknown-linux-musl.tar.xz"}
|
||||
"platforms.macos-arm64" = { checksum = "sha256:470aa49a2298d20b65c119a10e4ff8808550453e0cb4d85625b89caf0cedf048", url = "https://github.com/typst/typst/releases/download/v0.14.2/typst-aarch64-apple-darwin.tar.xz"}
|
||||
"platforms.macos-x64" = { checksum = "sha256:4e91d8e1e33ab164f949c5762e01ee3faa585c8615a2a6bd5e3677fa8506b249", url = "https://github.com/typst/typst/releases/download/v0.14.2/typst-x86_64-apple-darwin.tar.xz"}
|
||||
"platforms.windows-x64" = { checksum = "sha256:51353994ac83218c3497052e89b2c432c53b9d4439cdc1b361e2ea4798ebfc13", url = "https://github.com/typst/typst/releases/download/v0.14.2/typst-x86_64-pc-windows-msvc.zip"}
|
||||
|
||||
[[tools.typstyle]]
|
||||
version = "0.14.4"
|
||||
backend = "aqua:Enter-tainer/typstyle"
|
||||
"platforms.linux-arm64" = { checksum = "sha256:b8c220c0d940d7690fb15ef10415de35fdc115465a7534d8102459c68aeec74d", url = "https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-aarch64-unknown-linux-gnu"}
|
||||
"platforms.linux-x64" = { checksum = "sha256:48d9a9a3885855f1b4f6c2b8ea9739623bc458b99c015b77c4f50a1f342ea091", url = "https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-x86_64-unknown-linux-musl"}
|
||||
"platforms.macos-arm64" = { checksum = "sha256:dda3a162f2457a40570c3552cc9c01004138b33f2f921112b117d72f48bd6d56", url = "https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-aarch64-apple-darwin"}
|
||||
"platforms.macos-x64" = { checksum = "sha256:2343f7a4801d9bbda5d7441e8fea95f98b590d6aa3083da5c4e4ca3de885350f", url = "https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-x86_64-apple-darwin"}
|
||||
"platforms.windows-x64" = { checksum = "sha256:b16aebaed0aa296ef3e055d611f1e917f5849d3eb0f953bbcaa6f09f0503fb5b", url = "https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-x86_64-pc-windows-msvc.exe"}
|
||||
|
||||
[[tools.yq]]
|
||||
version = "4.52.2"
|
||||
backend = "aqua:mikefarah/yq"
|
||||
"platforms.linux-arm64" = { checksum = "sha256:c82856ac30da522f50dcdd4f53065487b5a2927e9b87ff637956900986f1f7c2", url = "https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_linux_arm64"}
|
||||
"platforms.linux-x64" = { checksum = "sha256:a74bd266990339e0c48a2103534aef692abf99f19390d12c2b0ce6830385c459", url = "https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_linux_amd64"}
|
||||
"platforms.macos-arm64" = { checksum = "sha256:34613ea97c4c77e1894a8978dbf72588d187a69a6292c10dab396c767a1ecde7", url = "https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_darwin_arm64"}
|
||||
"platforms.macos-x64" = { checksum = "sha256:54a63555210e73abed09108097072e28bf82a6bb20439a72b55509c4dd42378d", url = "https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_darwin_amd64"}
|
||||
"platforms.windows-x64" = { checksum = "sha256:2b6cd8974004fa0511f6b6b359d2698214fadeb4599f0b00e8d85ae62b3922d4", url = "https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_windows_amd64.exe"}
|
||||
83
template/unexplrd-mise/README.md
Normal file
83
template/unexplrd-mise/README.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# unexplrd's example setup with mise
|
||||
|
||||
This example has the following structure:
|
||||
```
|
||||
.
|
||||
├── .mise/
|
||||
│ ├── config.toml
|
||||
│ └── mise.lock
|
||||
├── vendor/
|
||||
│ └── typst-packages/
|
||||
│ └── ...
|
||||
└── src/
|
||||
├── assets/
|
||||
│ ├── foo.csv
|
||||
│ ├── bar.c
|
||||
│ └── ...
|
||||
├── figures/
|
||||
│ ├── clojure-logo.png
|
||||
│ ├── error-log.jpg
|
||||
│ └── ...
|
||||
├── doc.toml
|
||||
├── main.typ
|
||||
└── utils.typ
|
||||
```
|
||||
|
||||
## Advantages
|
||||
- Minimal: all you need is `mise`, see https://mise.jdx.dev/
|
||||
- Declarative approach: less unexpected behavior like broken versions in flaky setups
|
||||
- Fixed dependencies: locked Typst version, `nure` package fetched from a specific commit
|
||||
- Customizable: it's just a `.toml` file, modify it according to your needs
|
||||
|
||||
## Project structure
|
||||
All work contents are stored in `src/` to avoid clutter.
|
||||
|
||||
### Files
|
||||
- `src/doc.toml`: work-specific settings, could be auto-filled, see (TODO: add a demo nushell script)
|
||||
- `src/utils.typ`: utilities and functions used across the project
|
||||
- `src/main.typ`: main entry file
|
||||
|
||||
### Directories
|
||||
- `src/chapters/`: for breaking up the project into multiple files, if necessary
|
||||
- `src/figures/`: for images and pictures
|
||||
- `src/assets/`: other non-image, non-typst files
|
||||
|
||||
## Mise
|
||||
|
||||
### Tasks
|
||||
- `compile`: Execute `typst compile` on `src/main.typ`
|
||||
- `watch`: Execute `typst watch` on `src/main.typ`
|
||||
- `fetch-nure-package`: clone package git repository to a directory specified in `[vars]`
|
||||
- `update-package-rev`: updates `vars.nure_package_rev` with the last commit id from the specified branch (`vars.nure_package_ref`)
|
||||
|
||||
### Examples
|
||||
- A patch to add new subjects to the package:
|
||||
```diff
|
||||
diff --git a/src/config/universities.yaml b/src/config/universities.yaml
|
||||
index 8855a07..1aefc96 100644
|
||||
--- a/src/config/universities.yaml
|
||||
+++ b/src/config/universities.yaml
|
||||
@@ -60,7 +60,6 @@
|
||||
ПЕСЕ: Психологія екстремальних стосунків та ефективної адаптації
|
||||
ПНП: Програмування на платформі .NЕТ
|
||||
ПП: Проектний практикум
|
||||
- ПРОГ: Програмування
|
||||
ПарП: Параллельне програмування
|
||||
СА: Системний аналіз
|
||||
СМП: Скриптові мови програмування
|
||||
@@ -76,3 +75,10 @@
|
||||
ФІЛ: Філософія
|
||||
ФВС: Фізичне виховання та спорт
|
||||
ХТ: Хмарні технології
|
||||
+ АКС: Архітектура комп'ютерних систем
|
||||
+ ІКС: Інформаційно-комунікаційні системи
|
||||
+ МБ: Мережна безпека
|
||||
+ МКр: Мережна криміналістика
|
||||
+ ОКЗІ: Основи криптографічного захисту інформації
|
||||
+ Прог: Програмування
|
||||
+ ТІК: Теорія інформаціі та кодування
|
||||
```
|
||||
To apply it, add the following command to the `fetch_nure_package` task:
|
||||
```sh
|
||||
git -C {{vars.nure_package_path}} apply --check --apply --quiet $MISE_PROJECT_ROOT/custom-subjects.patch || exit 0
|
||||
```
|
||||
19
template/unexplrd-mise/src/doc.toml
Normal file
19
template/unexplrd-mise/src/doc.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
university = "ХНУРЕ"
|
||||
subject = "АКС"
|
||||
type = "ЛБ"
|
||||
number = 1
|
||||
|
||||
[[mentors]]
|
||||
name = ""
|
||||
degree = ""
|
||||
gender = ""
|
||||
|
||||
[[authors]]
|
||||
name = ""
|
||||
edu-program = "КУІБ"
|
||||
group = "24-1"
|
||||
gender = "m"
|
||||
variant = 6
|
||||
full-name-gen = ""
|
||||
course = 2
|
||||
semester = 4
|
||||
28
template/unexplrd-mise/src/main.typ
Normal file
28
template/unexplrd-mise/src/main.typ
Normal file
@@ -0,0 +1,28 @@
|
||||
#import "@vendor/nure:0.1.1": *
|
||||
#import "utils.typ": *
|
||||
|
||||
#import style: spacing
|
||||
|
||||
// Apply custom rule from utils.typ
|
||||
// #show: correctly-indent-list-and-enum-items
|
||||
|
||||
// #show: style.dstu
|
||||
#show: pz-lb.with(..toml("doc.toml"), title: "") // set title to none if empty
|
||||
|
||||
/// Useful snippets
|
||||
|
||||
/// Import a .csv table
|
||||
// #figure(
|
||||
// caption: [],
|
||||
// table(
|
||||
// columns: 4,
|
||||
// table.header([], [], [], []),
|
||||
// ..csv("assets/table.csv").flatten(),
|
||||
// ),
|
||||
// )
|
||||
|
||||
/// Appendices
|
||||
// #style.appendices(include "chapters/appendices.typ")
|
||||
// or
|
||||
// #show: style.appendices
|
||||
// = ...
|
||||
112
template/unexplrd-mise/src/utils.typ
Normal file
112
template/unexplrd-mise/src/utils.typ
Normal file
@@ -0,0 +1,112 @@
|
||||
#import "@vendor/nure:0.1.1": utils
|
||||
|
||||
/// captioned image with auto-generated label from path
|
||||
/// Usage: img("path/to/image.png", "Caption")(optional: "source")
|
||||
#let img(path, caption, ..sink) = {
|
||||
let source = sink.pos().at(0, default: ())
|
||||
[ #figure(image(path, ..sink.named()), caption: utils.img-caption(caption, source)) #utils.img-label(path) ]
|
||||
}
|
||||
|
||||
/// takes in a string of code, e.g. #code(read("foo.c"))
|
||||
#let code(content) = raw(block: true, theme: none, content)
|
||||
|
||||
/// read path as bytes
|
||||
#let b(path) = bytes(read(path, encoding: none))
|
||||
|
||||
/// include chapters by file names from /chapters
|
||||
#let chapters(ch) = (
|
||||
array(ch).map(chapter => include str(chapter) + ".typ").join()
|
||||
)
|
||||
|
||||
/// https://forum.typst.app/t/how-to-make-bullet-list-item-bodies-flow-like-paragraphs/3756/3?u=andrew
|
||||
/// Spacing doesn't work the same way as native solution if par leading and
|
||||
/// spacing are different.
|
||||
#let correctly-indent-list-and-enum-items(doc) = {
|
||||
let first-line-indent() = if type(par.first-line-indent) == dictionary {
|
||||
par.first-line-indent.amount
|
||||
} else {
|
||||
par.first-line-indent
|
||||
}
|
||||
|
||||
show list: li => {
|
||||
for (i, it) in li.children.enumerate() {
|
||||
let nesting = state("list-nesting", 0)
|
||||
let indent = context h((nesting.get() + 1) * li.indent)
|
||||
let get-nesting() = calc.div-euclid(nesting.get(), 10)
|
||||
let marker = context {
|
||||
let n = get-nesting()
|
||||
if type(li.marker) == array {
|
||||
li.marker.at(calc.rem-euclid(n, li.marker.len()))
|
||||
} else if type(li.marker) == content {
|
||||
li.marker
|
||||
} else {
|
||||
li.marker(n)
|
||||
}
|
||||
}
|
||||
let parents = state("enum-parents", ()) // Support enum nesting.
|
||||
let body = {
|
||||
parents.update(arr => arr + (-1,))
|
||||
nesting.update(x => x + 10)
|
||||
it.body + parbreak()
|
||||
nesting.update(x => x - 10)
|
||||
parents.update(arr => arr.slice(0, -1))
|
||||
}
|
||||
let content = {
|
||||
marker
|
||||
h(li.body-indent)
|
||||
body
|
||||
}
|
||||
context pad(left: int(nesting.get() != 0) * li.indent, content)
|
||||
}
|
||||
}
|
||||
|
||||
show enum: en => {
|
||||
let start = if en.start == auto {
|
||||
if en.children.first().has("number") {
|
||||
if en.reversed { en.children.first().number } else { 1 }
|
||||
} else {
|
||||
if en.reversed { en.children.len() } else { 1 }
|
||||
}
|
||||
} else {
|
||||
en.start
|
||||
}
|
||||
let number = start
|
||||
for (i, it) in en.children.enumerate() {
|
||||
number = if it.number != auto { it.number } else { number }
|
||||
if en.reversed { number = start - i }
|
||||
let parents = state("enum-parents", ())
|
||||
let get-parents() = parents.get().filter(x => x >= 0)
|
||||
let indent = context h((get-parents().len() + 1) * en.indent)
|
||||
let num = if en.full {
|
||||
context numbering(en.numbering, ..get-parents(), number)
|
||||
} else {
|
||||
numbering(en.numbering, number)
|
||||
}
|
||||
let max-num = if en.full {
|
||||
context numbering(en.numbering, ..get-parents(), en.children.len())
|
||||
} else {
|
||||
numbering(en.numbering, en.children.len())
|
||||
}
|
||||
num = context box(
|
||||
width: measure(max-num).width,
|
||||
align(right, text(overhang: false, num)),
|
||||
)
|
||||
let list-nesting = state("list-nesting", 0) // Support list nesting.
|
||||
let body = {
|
||||
parents.update(arr => arr + (number,))
|
||||
list-nesting.update(x => x + 1)
|
||||
it.body + parbreak()
|
||||
list-nesting.update(x => x - 1)
|
||||
parents.update(arr => arr.slice(0, -1))
|
||||
}
|
||||
if not en.reversed { number += 1 }
|
||||
let content = {
|
||||
num
|
||||
h(en.body-indent)
|
||||
body
|
||||
}
|
||||
context pad(left: int(parents.get().len() != 0) * en.indent, content)
|
||||
}
|
||||
}
|
||||
doc
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "nure"
|
||||
version = "0.0.0"
|
||||
entrypoint = "lib.typ"
|
||||
version = "0.1.1"
|
||||
entrypoint = "src/lib.typ"
|
||||
authors = ["linerds"]
|
||||
license = "GPL-3.0"
|
||||
description = "Typst NURE package"
|
||||
|
||||
[template]
|
||||
path = "template"
|
||||
path = "template/default"
|
||||
entrypoint = "lab.typ"
|
||||
|
||||
Reference in New Issue
Block a user