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

@@ -335,8 +335,12 @@ Zvýrazněné hodnoty jsou základní -- pokud vynecháte parametr, pak bude pou
- `"feminine"` - Ženský rod - `"feminine"` - Ženský rod
- `"we"` - Množné číslo - `"we"` - Množné číslo
#line() #line()
- `supervisor` (vedoucí práce) - `supervisor` (vedoucí práce) <arg_supervisor>
- Příklad: `"prof. Jindřich Jindřich"` - V podobě textového řetězce, příklad: `"prof. Jindřich Jindřich"`
- Ve formátu `(name: "<jméno>", institute: "<institut>")` (toto lze využít například při DP)
#line()
- `consultant` (konzultant práce)
- Stejně jako u #link(label("arg_supervisor"), [`supervisor`])
#line() #line()
- `programme` (studijní program autora) - `programme` (studijní program autora)
- Ve formátu `(<zkratka_jazyka>: "<název_programu>")` - Ve formátu `(<zkratka_jazyka>: "<název_programu>")`

View File

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

View File

@@ -12,7 +12,8 @@
language, faculty_id, document_type, citation_file, assignment_document, language, faculty_id, document_type, citation_file, assignment_document,
// document info // 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
content, content,

View File

@@ -1,6 +1,6 @@
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color #import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
#import "../lang.typ": get_lang_item #import "../lang.typ": get_lang_item
#import "../utils.typ": is_none #import "../utils.typ": is_none, assert_dict_has
#let base_font = "Inter"; #let base_font = "Inter";
#let mono_font = "Noto Sans Mono"; #let mono_font = "Noto Sans Mono";
@@ -92,6 +92,29 @@
// 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( #let info(
faculty_id, faculty_id,
language, language,
@@ -120,8 +143,8 @@
("study_programme", study_programme, false), ("study_programme", study_programme, false),
("study_branch", study_branch, false), ("study_branch", study_branch, false),
("author", author, true), ("author", author, true),
("supervisor", supervisor, false), ("supervisor", person_info(supervisor, "supervisor"), false),
("consultant", consultant, false), ("consultant", person_info(consultant, "consultant"), false),
) )
context { context {
let max_field_name_width = calc.max(..info_fields.map((v) => { let max_field_name_width = calc.max(..info_fields.map((v) => {
@@ -133,7 +156,7 @@
}), info_name_min_width.to-absolute()); }), info_name_min_width.to-absolute());
grid( grid(
columns: 2, columns: 2,
gutter: .5em, gutter: .7em,
..info_fields.filter((v) => { type(v.at(1)) != type(none) }).map((v) => { ..info_fields.filter((v) => { type(v.at(1)) != type(none) }).map((v) => {
( (
align(top, block( align(top, block(

View File

@@ -28,9 +28,9 @@
mainpage(faculty_id, language, none, title, author, supervisor, consultant, study_programme, study_branch); mainpage(faculty_id, language, none, title, author, supervisor, consultant, study_programme, study_branch);
default_styling(true, faculty_color, { default_styling(true, faculty_color, {
toc(language); toc(language);
abbrlist(language);
imagelist(language);
tablelist(language); tablelist(language);
imagelist(language);
abbrlist(language);
pagebreak(to: "even", weak: true); pagebreak(to: "even", weak: true);
content; content;
bibliography(citation_file, style: "../tul_citace.csl"); 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, "string | none", "author argument");
assert_type_signature(author_gender, "string | none", "author gender argument"); assert_type_signature(author_gender, "string | none", "author gender argument");
assert_type_signature(supervisor, "string | none", "supervisor argument"); assert_type_signature(
assert_type_signature(consultant, "string | none", "consultant argument"); supervisor, "string | dictionary[string : string] | none", "supervisor argument"
);
assert_type_signature(
consultant, "string | dictionary[string : string] | none", "consultant argument"
);
assert_type_signature( assert_type_signature(
programme, "dictionary[string : string] | none", "study programme argument" programme, "dictionary[string : string] | none", "study programme argument"
); );