diff --git a/template/classic/bp.typ b/template/classic/bp.typ index 9279b9f..52e797d 100644 --- a/template/classic/bp.typ +++ b/template/classic/bp.typ @@ -16,12 +16,20 @@ faculty_id, faculty_color, language, assignment_document, citation_file, // document info - title, author, author_gender, supervisor, study_programme, abstract_content, keywords, + title, author, author_gender, supervisor, study_programme, study_branch, abstract_content, + keywords, content ) = { let force_langs = ("cs", "en"); + assert_not_none(title, "title"); assert_dict_has(force_langs, title, "title"); + + assert_not_none(study_programme, "study programme"); + assert_dict_has((language,), study_programme, "study programme"); + assert_not_none(study_branch, "study branch"); + assert_dict_has((language,), study_branch, "study branch"); + assert_not_none(abstract_content, "abstract"); assert_dict_has(force_langs, abstract_content, "abstract"); if not is_none(keywords) { @@ -31,7 +39,7 @@ assert_not_none(author_gender, "author gender"); } - mainpage(faculty_id, language, "bp", title, author, supervisor, study_programme); + mainpage(faculty_id, language, "bp", title, author, supervisor, study_programme, study_branch); assignment(language, assignment_document); default_styling(false, faculty_color, { disclaimer(language, faculty_id, "bp", author, author_gender); diff --git a/template/classic/classic.typ b/template/classic/classic.typ index 570b32b..dcccaea 100644 --- a/template/classic/classic.typ +++ b/template/classic/classic.typ @@ -1,7 +1,7 @@ // tools & utils #import "../theme.typ": faculty_logotype, tul_logomark, faculty_color #import "../lang.typ": lang_id, get_lang_item -#import "../utils.typ": assert_in_dict, assert_in_arr, map_none +#import "../utils.typ": assert_in_dict, assert_in_arr, map_none, assert_dict_has // thesis types #import "bp.typ": bp @@ -12,16 +12,21 @@ language, faculty_id, document_type, citation_file, assignment_document, // document info - title, author, author_gender, supervisor, study_programme, abstract, keywords, + title, author, author_gender, supervisor, study_programme, study_branch, abstract, keywords, // content content, ) = { + // argument pre-checking let document_types = ( "bp": bp, "other": other, ) assert_in_dict(document_type, document_types, "document type"); + map_none(title, (v) => assert_dict_has((language,), v, "title")); + map_none(study_programme, (v) => assert_dict_has((language,), v, "study programme")); + map_none(study_branch, (v) => assert_dict_has((language,), v, "study branch")); + document_types.at(document_type)( faculty_id, @@ -34,6 +39,7 @@ author_gender, supervisor, study_programme, + study_branch, abstract, keywords, content, diff --git a/template/classic/common.typ b/template/classic/common.typ index 7abdf49..b278dbb 100644 --- a/template/classic/common.typ +++ b/template/classic/common.typ @@ -75,7 +75,7 @@ faculty_id, language, document_type, - title, author, supervisor, study_programme, + title, author, supervisor, study_programme, study_branch, ) = { let info_name_value_padding = 5em; let info_name_min_width = 10em; @@ -97,6 +97,7 @@ // [field_name, field_value, bold] let info_fields = ( ("study_programme", study_programme, false), + ("study_branch", study_branch, false), ( if not is_none(author) and author.contains(", ") {"authors" } else { "author" }, author, true ), @@ -135,9 +136,9 @@ faculty_id, language, document_type, - title, author, supervisor, study_programme, + title, author, supervisor, study_programme, study_branch ) = { - import "../utils.typ": has_all_none + import "../utils.typ": has_all_none, map_none let nonetype = type(none); page({ if has_all_none(( @@ -148,8 +149,9 @@ header(faculty_id, language); align({ info( - faculty_id, language, document_type, title.at(language), - author, supervisor, study_programme, + faculty_id, language, document_type, map_none(title, (v) => v.at(language)), + author, supervisor, map_none(study_programme, (v) => v.at(language)), + map_none(study_branch, (v) => v.at(language)), ); v(5em); }, bottom); diff --git a/template/classic/other.typ b/template/classic/other.typ index 68321d0..5b6c346 100644 --- a/template/classic/other.typ +++ b/template/classic/other.typ @@ -1,17 +1,26 @@ #import "../lang.typ": get_lang_item #import "common.typ": mainpage, default_styling, assignment, disclaimer, abstract, toc, abbrlist -#import "../utils.typ": is_none +#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr #let other( // general settings faculty_id, faculty_color, language, assignment_document, citation_file, // document info - title, author, _, supervisor, study_programme, abstract_content, keywords, + title, author, _, supervisor, study_programme, study_branch, abstract_content, keywords, content ) = { - mainpage(faculty_id, language, none, title, author, supervisor, study_programme); + let force_langs = ("cs", "en"); + assert_not_none(title, "title"); + assert_dict_has(force_langs, title, "title"); + + assert_not_none(study_programme, "study programme"); + assert_in_arr(language, study_programme, "study programme"); + assert_not_none(study_branch, "study branch"); + assert_in_arr(language, study_branch, "study branch"); + + mainpage(faculty_id, language, none, title, author, supervisor, study_programme, study_branch); default_styling(true, faculty_color, { toc(language); abbrlist(language); diff --git a/template/lang.json b/template/lang.json index 5eb3543..a944bfd 100644 --- a/template/lang.json +++ b/template/lang.json @@ -4,6 +4,7 @@ "authors": "Autoři", "supervisor": "Vedoucí práce", "study_programme": "Studijní program", + "study_branch": "Studijní obor", "bp": "Bakalářská práce", "dp": "Diplomová práce", @@ -47,6 +48,7 @@ "authors": "Authors", "supervisor": "Supervisor", "study_programme": "Study programme", + "study_branch": "Study branch", "bp": "Bachelor thesis", "dp": "Diploma thesis", diff --git a/template/template.typ b/template/template.typ index e0e8b73..98cc531 100644 --- a/template/template.typ +++ b/template/template.typ @@ -41,7 +41,7 @@ // document info title: none, keywords: none, abstract: none, author: none, author_gender: none, - supervisor: none, programme: none, + supervisor: none, programme: none, branch: none, // links assignment: none, citations: "citations.bib", @@ -67,6 +67,7 @@ assert_type_signature( programme, "dictionary[string : string] | none", "study programme argument" ); + assert_type_signature(branch, "dictionary[string : string] | none", "study branch argument"); assert_type_signature(assignment, "string | none", "assignment document argument"); assert_type_signature(citations, "string", "citations file argument"); @@ -85,7 +86,7 @@ // template call templates.at(style)( lang, faculty, document, citations, assignment, - title, author, author_gender, supervisor, programme, abstract, keywords, + title, author, author_gender, supervisor, programme, branch, abstract, keywords, content );