add study branch to info page

This commit is contained in:
2025-10-02 14:11:14 +02:00
parent afe325da0a
commit 85a6ed8d44
6 changed files with 42 additions and 14 deletions

View File

@@ -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);

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);