1
0
Files
typst-nure-template/template.typ

126 lines
3.6 KiB
Typst
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// SPDX-License-Identifier: GPL-3.0
/*
* typst-nure-template/template.typ
*
* Typst templates for NURE (Kharkiv National University of Radio Electronics) works
*/
#import "style.typ": spacing, dstu-style, appendices-style
// Practice and Laboratory works template {{{
/// DSTU 3008:2015 Template for NURE
/// -> content
/// - it (content): Content to apply the template to.
/// - department (str): Education program name.
/// - work_type (str): Work type, i.e. "з лабораторної роботи".
/// - number (int | none): Number of the work. Optional.
/// - subject (str): Subject name.
/// - title (str | none): Title of the work and the document. Optional.
/// - variant (int | none): Variant of the work. Optional.
/// - author ((name: str, group: (str | none), gender: ("m" | "f" | none)),):
/// List of authors. Single author may be passed as a dictionary. Other types will be displayed like content.
/// - mentor ((name: str, degree: (str | none), gender: ("m" | "f" | none)),):
/// List of mentors. Single mentor may be passed as a dictionary. Other types will be displayed like content.
#let general(
it,
department: none,
work_type: none,
number: none,
subject: none,
title: none,
variant: none,
author: (),
mentor: (),
year: datetime.today().display("[year]"),
) = {
if type(author) == array and author.len() == 1 { author = author.at(0) }
if type(mentor) == array and mentor.len() == 1 { mentor = mentor.at(0) }
set document(
title: title,
author: if type(author) == array {
author.map(a => a.name)
} else if type(author) == dictionary { author.name } else { "" },
)
show: dstu-style.with(skip: 1)
align(center)[
МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ
ХАРКІВСЬКИЙ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ РАДІОЕЛЕКТРОНІКИ
\ \ \
Кафедра #department
\ \ \ \
Звіт
#work_type #if number != none [
#number
#counter(heading).update(number - if title != none { 1 } else { 0 })
]
з дисципліни: "#subject"
#if title != none [з теми: "#title"]
\ \ \ \
#columns(2)[
#set par(first-line-indent: 0pt)
//
#set align(left)
//
#if type(author) == dictionary [
#if "gender" in author and author.gender != none {
if author.gender == "m" [Виконав:] else [Виконала:]
} else [Виконали:]
#if "group" in author [ст. гр. #author.group\ ]
#author.name\
#if variant != none [Варіант: #variant]
] else if type(author) == array [
Виконали:
#for a in author [
#if "group" in a [ст. гр. #a.group\ ]
#a.name\
]
#if variant != none [Варіант: #variant]
] else { author } // custom formatting
//
#colbreak()
//
#set align(right)
//
#if type(mentor) == dictionary [
#if "gender" in mentor and mentor.gender != none {
if mentor.gender == "m" [Перевірив:] else [Перевірила:]
} else [Перевірили:]
#if "degree" in mentor and mentor.degree != none [#mentor.degree\ ]
#mentor.name
] else if type(mentor) == array [
Перевірили:
#for m in mentor [
#if "degree" in m [#m.degree\ ]
#m.name\
]
] else { mentor } // custom formatting
]
#v(1fr)
Харків -- #year
]
pagebreak(weak: true)
if title != none { heading(title) }
it
} // }}}
// vim:sts=2:sw=2:fdl=0:fdm=marker:cms=/*%s*/