forked from pencelheimer/typst_nure_template
feat!: rename some parametes to avoid redundancy
fix: avoid hard-coded defaults docs(readme): add more detail
This commit is contained in:
19
README.md
19
README.md
@ -9,7 +9,7 @@ This project contains two template functions and some utilities for writing NURE
|
|||||||
#### `pz-lb-template` - For Laboratory and Practical Works
|
#### `pz-lb-template` - For Laboratory and Practical Works
|
||||||
This template:
|
This template:
|
||||||
- Sets up document styles;
|
- 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
|
#### `cw-template` - For Course Works
|
||||||
This template:
|
This template:
|
||||||
@ -36,14 +36,15 @@ git clone https://gitea.linerds.us/pencelheimer/typst_nure_template.git ~/.local
|
|||||||
typst init @local/nure:0.0.0 project-name
|
typst init @local/nure:0.0.0 project-name
|
||||||
```
|
```
|
||||||
|
|
||||||
### As a file in your project
|
### As a standalone file
|
||||||
Include lib.typ in your project and utilize the provided functions:
|
Copy `lib.typ` to your project's root directory.
|
||||||
|
|
||||||
|
### In your project
|
||||||
```typst
|
```typst
|
||||||
// Import the template either from a local package...
|
// Import the template either from a local package...
|
||||||
#import "@local/nure:0.0.0": *
|
#import "@local/nure:0.0.0": *
|
||||||
// ...or by importing a lib.typ directly from a project's root directory
|
// ...or by importing a lib.typ directly
|
||||||
// #import "lib.typ": *
|
// #import "/lib.typ": *
|
||||||
|
|
||||||
// Setup the document
|
// Setup the document
|
||||||
#show: pz-lb-template.with(
|
#show: pz-lb-template.with(
|
||||||
@ -53,10 +54,16 @@ Include lib.typ in your project and utilize the provided functions:
|
|||||||
)
|
)
|
||||||
// this template automatically inserts a `=title`
|
// this template automatically inserts a `=title`
|
||||||
|
|
||||||
// Write your content
|
// Write your content...
|
||||||
#v(-spacing) // remove spacing between headings
|
#v(-spacing) // remove spacing between headings
|
||||||
== Purpose
|
== Purpose
|
||||||
Some text
|
Some text
|
||||||
|
|
||||||
|
// ...or include your modules
|
||||||
|
// NOTE: you have to import a package or a lib.typ in each module.
|
||||||
|
#include "src/intro.typ"
|
||||||
|
#include "src/chapter1.typ"
|
||||||
|
#include "src/chapter2.typ"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Notes:
|
### Notes:
|
||||||
|
56
lib.typ
56
lib.typ
@ -10,18 +10,17 @@
|
|||||||
"ПП": "Проектний практикум",
|
"ПП": "Проектний практикум",
|
||||||
"СПМ": "Скриптові мови програмування",
|
"СПМ": "Скриптові мови програмування",
|
||||||
"Ф": "Філософія",
|
"Ф": "Філософія",
|
||||||
|
"ФІЗ": "Фізика",
|
||||||
)
|
)
|
||||||
|
|
||||||
/// education program abbreviations to name & number
|
/// education program abbreviations to name & number
|
||||||
#let edu_programs = (
|
#let edu_programs = (
|
||||||
"ПЗПІ": (
|
"ПЗПІ": (
|
||||||
name: "ПЗПІ", // i don't like it
|
|
||||||
name-long: "Інженерія програмного забезпечення",
|
name-long: "Інженерія програмного забезпечення",
|
||||||
department_gen: "Програмної інженерії",
|
department_gen: "Програмної інженерії",
|
||||||
code: 121, // TODO: ПЗПІ is "F2" now
|
code: 121, // TODO: ПЗПІ is "F2" now
|
||||||
),
|
),
|
||||||
"КУІБ": (
|
"КУІБ": (
|
||||||
name: "КУІБ", // i don't like it
|
|
||||||
name-long: "Управління інформаційною безпекою",
|
name-long: "Управління інформаційною безпекою",
|
||||||
department_gen: "Інфокомунікацій",
|
department_gen: "Інфокомунікацій",
|
||||||
code: 125,
|
code: 125,
|
||||||
@ -268,10 +267,10 @@
|
|||||||
/// -> content
|
/// -> content
|
||||||
/// - doc (content): Content to apply the template to.
|
/// - doc (content): Content to apply the template to.
|
||||||
/// - title (str): Title of the document.
|
/// - title (str): Title of the document.
|
||||||
/// - subject_short (str): Subject short name.
|
/// - subject (str): Subject short name.
|
||||||
/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts.
|
/// - 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.
|
/// - mentors ((name: str, gender: str, degree: str),): List of mentors dicts.
|
||||||
/// - edu_program_short (str): Education program shorthand.
|
/// - edu_program (str): Education program shorthand.
|
||||||
/// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object.
|
/// - 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.
|
/// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object.
|
||||||
/// - abstract (keywords: (str, ), text: (content | str)): Abstract object.
|
/// - abstract (keywords: (str, ), text: (content | str)): Abstract object.
|
||||||
@ -279,11 +278,11 @@
|
|||||||
/// - appendices (content): Content with appendices.
|
/// - appendices (content): Content with appendices.
|
||||||
#let cw-template(
|
#let cw-template(
|
||||||
doc,
|
doc,
|
||||||
title: "NONE",
|
title: none,
|
||||||
subject_short: "NONE",
|
subject: none,
|
||||||
author: (),
|
author: (),
|
||||||
mentors: (),
|
mentors: (),
|
||||||
edu_program_short: "ПЗПІ",
|
edu_program: none,
|
||||||
task_list: (),
|
task_list: (),
|
||||||
calendar_plan: (),
|
calendar_plan: (),
|
||||||
abstract: (),
|
abstract: (),
|
||||||
@ -306,7 +305,7 @@
|
|||||||
|
|
||||||
|
|
||||||
let head_mentor = mentors.at(0)
|
let head_mentor = mentors.at(0)
|
||||||
let edu_program = edu_programs.at(edu_program_short)
|
let edu_prog = edu_programs.at(edu_program)
|
||||||
|
|
||||||
// page 1 {{{2
|
// page 1 {{{2
|
||||||
[
|
[
|
||||||
@ -317,7 +316,7 @@
|
|||||||
|
|
||||||
\
|
\
|
||||||
|
|
||||||
Кафедра Програмної інженерії
|
Кафедра #edu_prog.department_gen
|
||||||
|
|
||||||
\
|
\
|
||||||
|
|
||||||
@ -325,7 +324,7 @@
|
|||||||
|
|
||||||
ДО КУРСОВОЇ РОБОТИ
|
ДО КУРСОВОЇ РОБОТИ
|
||||||
|
|
||||||
з дисципліни: "#subjects.at(subject_short, default: "NONE")"
|
з дисципліни: "#subjects.at(subject, default: "NONE")"
|
||||||
|
|
||||||
Тема роботи: "#title"
|
Тема роботи: "#title"
|
||||||
|
|
||||||
@ -391,11 +390,11 @@
|
|||||||
Спеціальність
|
Спеціальність
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
uline(align: left, edu_program.department_gen)
|
uline(align: left, edu_prog.department_gen)
|
||||||
linebreak()
|
linebreak()
|
||||||
uline(align: left, subjects.at(subject_short))
|
uline(align: left, subjects.at(subject))
|
||||||
linebreak()
|
linebreak()
|
||||||
uline(align: left, [#edu_program.code #edu_program.name-long])
|
uline(align: left, [#edu_prog.code #edu_prog.name-long])
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
grid(
|
grid(
|
||||||
@ -664,19 +663,19 @@
|
|||||||
/// -> content
|
/// -> content
|
||||||
/// - doc (content): Content to apply the template to.
|
/// - doc (content): Content to apply the template to.
|
||||||
/// - doctype ("ЛБ" | "ПЗ"): Document type.
|
/// - doctype ("ЛБ" | "ПЗ"): Document type.
|
||||||
/// - edu_program_short (str): Education program shorthand.
|
/// - edu_program (str): Education program shorthand.
|
||||||
/// - title (str): Title of the document.
|
/// - title (str): Title of the document.
|
||||||
/// - subject_short (str): Subject short name.
|
/// - subject (str): Subject shorthand.
|
||||||
/// - worknumber (int): Number of the work, can be omitted.
|
/// - authors ((name: str, full_name_gen: str, group: str, gender: str, variant: int or none),): List of authors.
|
||||||
/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts.
|
/// - mentors ((name: str, degree: str, gender: str or none),): List of mentors.
|
||||||
/// - mentors ((name: str, degree: str, gender: str or none): Mentors objects.
|
/// - worknumber (int or none): Number of the work. Optional.
|
||||||
#let pz-lb-template(
|
#let pz-lb-template(
|
||||||
doc,
|
doc,
|
||||||
doctype: none,
|
doctype: none,
|
||||||
edu_program_short: edu_programs.keys().first(),
|
edu_program: none,
|
||||||
title: none,
|
title: none,
|
||||||
subject_short: none,
|
subject: none,
|
||||||
worknumber: 1,
|
worknumber: none,
|
||||||
authors: (),
|
authors: (),
|
||||||
mentors: (),
|
mentors: (),
|
||||||
) = {
|
) = {
|
||||||
@ -684,25 +683,24 @@
|
|||||||
|
|
||||||
show: style
|
show: style
|
||||||
|
|
||||||
let edu_program = edu_programs.at(edu_program_short)
|
|
||||||
|
|
||||||
context counter(heading).update(worknumber - 1)
|
|
||||||
|
|
||||||
// page 1 {{{2
|
// page 1 {{{2
|
||||||
align(center)[
|
align(center)[
|
||||||
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \
|
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ \
|
||||||
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
|
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
|
||||||
|
|
||||||
\ \
|
\ \
|
||||||
Кафедра #edu_program.department_gen
|
Кафедра #edu_programs.at(edu_program).department_gen
|
||||||
|
|
||||||
\ \ \
|
\ \ \
|
||||||
Звіт \
|
Звіт \
|
||||||
з
|
з
|
||||||
#if doctype == "ЛБ" [лабораторної роботи] else [практичної роботи]
|
#if doctype == "ЛБ" [лабораторної роботи] else [практичної роботи]
|
||||||
#if worknumber != none [№ #worknumber]
|
#if worknumber != none {
|
||||||
|
context counter(heading).update(worknumber - 1)
|
||||||
|
[№#worknumber]
|
||||||
|
}
|
||||||
|
|
||||||
з дисципліни: "#subjects.at(subject_short, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")"
|
з дисципліни: "#subjects.at(subject, default: "UNKNOWN SUBJECT, PLEASE OPEN AN ISSUE")"
|
||||||
|
|
||||||
з теми: "#title"
|
з теми: "#title"
|
||||||
|
|
||||||
@ -715,7 +713,7 @@
|
|||||||
let author = authors.at(0)
|
let author = authors.at(0)
|
||||||
if author.gender == "m" [Виконав:\ ] else [Виконала:\ ]
|
if author.gender == "m" [Виконав:\ ] else [Виконала:\ ]
|
||||||
[
|
[
|
||||||
ст. гр. #edu_program.name\-#author.group\
|
ст. гр. #edu_program\-#author.group\
|
||||||
#author.name\
|
#author.name\
|
||||||
]
|
]
|
||||||
if author.variant != none [Варіант: №#author.variant]
|
if author.variant != none [Варіант: №#author.variant]
|
||||||
|
Reference in New Issue
Block a user