add optional institute for supervisor and consultant entries

This commit is contained in:
2025-10-03 19:02:09 +02:00
parent f66f36d560
commit f22b16a803
6 changed files with 56 additions and 18 deletions

View File

@@ -12,15 +12,15 @@
bibliogr
)
#import "../attachments.typ": attachment_list
#import "../utils.typ": is_none, assert_dict_has, assert_not_none
#import "../utils.typ": is_none, assert_dict_has, assert_not_none, assert_type_signature
#let bp(
// general settings
faculty_id, faculty_color, language, assignment_document, citation_file,
// document info
title, author, author_gender, supervisor, consultant, study_programme, study_branch, abstract_content,
keywords,
title, author, author_gender, supervisor, consultant, study_programme, study_branch,
abstract_content, keywords,
content
) = {
@@ -42,16 +42,22 @@
assert_not_none(author_gender, "author gender");
}
mainpage(faculty_id, language, "bp", title, author, supervisor, consultant, study_programme, study_branch);
assert_type_signature(supervisor, "string | none", "supervisor");
assert_type_signature(consultant, "string | none", "consultant");
mainpage(
faculty_id, language, "bp", title, author, supervisor, consultant, study_programme,
study_branch,
);
assignment(language, assignment_document);
default_styling(false, faculty_color, {
disclaimer(language, faculty_id, "bp", author, author_gender);
abstract("cs", title, abstract_content, keywords);
abstract("en", title, abstract_content, keywords);
toc(language);
abbrlist(language);
imagelist(language);
tablelist(language);
imagelist(language);
abbrlist(language);
pagebreak(weak: true);
content;
bibliogr(language, citation_file);

View File

@@ -12,7 +12,8 @@
language, faculty_id, document_type, citation_file, assignment_document,
// document info
title, author, author_gender, supervisor, consultant, study_programme, study_branch, abstract, keywords,
title, author, author_gender, supervisor, consultant, study_programme, study_branch, abstract,
keywords,
// content
content,

View File

@@ -1,6 +1,6 @@
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
#import "../lang.typ": get_lang_item
#import "../utils.typ": is_none
#import "../utils.typ": is_none, assert_dict_has
#let base_font = "Inter";
#let mono_font = "Noto Sans Mono";
@@ -90,7 +90,30 @@
);
}
// DOCUMENT INFO
// DOCUMENT INFO
#let person_info(record, item_name) = {
if is_none(record) {
none
} else if type(record) == str {
record
} else if type(record) == dictionary {
if "name" in record {
record.at("name");
if "institute" in record {
text("\n " + record.at("institute"), style: "italic")
}
} else {
let panic_message = (
item_name + " name is required (or try not specifying " + item_name + " at all)"
);
panic(panic_message);
}
} else {
let panic_message = "invalid " + item_name + " - expected a string or a dictionary";
panic(panic_message);
}
}
#let info(
faculty_id,
@@ -120,8 +143,8 @@
("study_programme", study_programme, false),
("study_branch", study_branch, false),
("author", author, true),
("supervisor", supervisor, false),
("consultant", consultant, false),
("supervisor", person_info(supervisor, "supervisor"), false),
("consultant", person_info(consultant, "consultant"), false),
)
context {
let max_field_name_width = calc.max(..info_fields.map((v) => {
@@ -133,7 +156,7 @@
}), info_name_min_width.to-absolute());
grid(
columns: 2,
gutter: .5em,
gutter: .7em,
..info_fields.filter((v) => { type(v.at(1)) != type(none) }).map((v) => {
(
align(top, block(

View File

@@ -28,9 +28,9 @@
mainpage(faculty_id, language, none, title, author, supervisor, consultant, study_programme, study_branch);
default_styling(true, faculty_color, {
toc(language);
abbrlist(language);
imagelist(language);
tablelist(language);
imagelist(language);
abbrlist(language);
pagebreak(to: "even", weak: true);
content;
bibliography(citation_file, style: "../tul_citace.csl");

View File

@@ -68,8 +68,12 @@
);
assert_type_signature(author, "string | none", "author argument");
assert_type_signature(author_gender, "string | none", "author gender argument");
assert_type_signature(supervisor, "string | none", "supervisor argument");
assert_type_signature(consultant, "string | none", "consultant argument");
assert_type_signature(
supervisor, "string | dictionary[string : string] | none", "supervisor argument"
);
assert_type_signature(
consultant, "string | dictionary[string : string] | none", "consultant argument"
);
assert_type_signature(
programme, "dictionary[string : string] | none", "study programme argument"
);