diff --git a/example.typ b/example.typ index 8a2d465..1347d99 100644 --- a/example.typ +++ b/example.typ @@ -335,8 +335,12 @@ Zvýrazněné hodnoty jsou základní -- pokud vynecháte parametr, pak bude pou - `"feminine"` - Ženský rod - `"we"` - Množné číslo #line() -- `supervisor` (vedoucí práce) - - Příklad: `"prof. Jindřich Jindřich"` +- `supervisor` (vedoucí práce) + - V podobě textového řetězce, příklad: `"prof. Jindřich Jindřich"` + - Ve formátu `(name: "", institute: "")` (toto lze využít například při DP) +#line() +- `consultant` (konzultant práce) + - Stejně jako u #link(label("arg_supervisor"), [`supervisor`]) #line() - `programme` (studijní program autora) - Ve formátu `(: "")` diff --git a/template/classic/bp.typ b/template/classic/bp.typ index e341afd..9a4a4c6 100644 --- a/template/classic/bp.typ +++ b/template/classic/bp.typ @@ -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); diff --git a/template/classic/classic.typ b/template/classic/classic.typ index e8f12f1..37c5a9b 100644 --- a/template/classic/classic.typ +++ b/template/classic/classic.typ @@ -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, diff --git a/template/classic/common.typ b/template/classic/common.typ index ee679ec..53c3741 100644 --- a/template/classic/common.typ +++ b/template/classic/common.typ @@ -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( diff --git a/template/classic/other.typ b/template/classic/other.typ index 183d528..5842ea8 100644 --- a/template/classic/other.typ +++ b/template/classic/other.typ @@ -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"); diff --git a/template/template.typ b/template/template.typ index 4d6d19f..87f5852 100644 --- a/template/template.typ +++ b/template/template.typ @@ -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" );