forked from pencelheimer/typst_nure_template
feat(template): add asserts
This commit is contained in:
4
lib.typ
4
lib.typ
@ -75,9 +75,9 @@
|
|||||||
}.replace(" ", "_")
|
}.replace(" ", "_")
|
||||||
|
|
||||||
let caption = if sink.pos().len() == 0 {
|
let caption = if sink.pos().len() == 0 {
|
||||||
caption + " (рисунок виконано самостійно)"
|
|
||||||
} else if sink.pos().first() == none {
|
|
||||||
caption
|
caption
|
||||||
|
} else if sink.pos().first() == none {
|
||||||
|
caption + " (рисунок виконано самостійно)"
|
||||||
} else {
|
} else {
|
||||||
[#caption (за даними #sink.pos().first())]
|
[#caption (за даними #sink.pos().first())]
|
||||||
}
|
}
|
||||||
|
12
template.typ
12
template.typ
@ -19,9 +19,9 @@
|
|||||||
/// - title (str | none): Title of the work and the document. Optional.
|
/// - title (str | none): Title of the work and the document. Optional.
|
||||||
/// - variant (int | none): Variant of the work. Optional.
|
/// - variant (int | none): Variant of the work. Optional.
|
||||||
/// - author ((name: str, group: (str | none), gender: ("m" | "f" | none)),):
|
/// - 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.
|
/// A dictionary of one author or an array of authors. Other types will be just displayed.
|
||||||
/// - mentor ((name: str, degree: (str | none), gender: ("m" | "f" | none)),):
|
/// - 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.
|
/// A dictionary of one mentor or an array of mentors. Other types will be just displayed.
|
||||||
#let general(
|
#let general(
|
||||||
it,
|
it,
|
||||||
department: none,
|
department: none,
|
||||||
@ -30,10 +30,14 @@
|
|||||||
subject: none,
|
subject: none,
|
||||||
title: none,
|
title: none,
|
||||||
variant: none,
|
variant: none,
|
||||||
author: (),
|
author: none,
|
||||||
mentor: (),
|
mentor: none,
|
||||||
year: datetime.today().display("[year]"),
|
year: datetime.today().display("[year]"),
|
||||||
) = {
|
) = {
|
||||||
|
assert.ne(department, none, message: "Missing argument: \"department\"")
|
||||||
|
assert.ne(work_type, none, message: "Missing argument: \"work_type\"")
|
||||||
|
assert.ne(subject, none, message: "Missing argument: \"subject\"")
|
||||||
|
|
||||||
if type(author) == array and author.len() == 1 { author = author.at(0) }
|
if type(author) == array and author.len() == 1 { author = author.at(0) }
|
||||||
if type(mentor) == array and mentor.len() == 1 { mentor = mentor.at(0) }
|
if type(mentor) == array and mentor.len() == 1 { mentor = mentor.at(0) }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user