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, faculty_id, faculty_color, language, assignment_document, citation_file,
// document info // 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 content
) = { ) = {
let force_langs = ("cs", "en"); let force_langs = ("cs", "en");
assert_not_none(title, "title");
assert_dict_has(force_langs, 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_not_none(abstract_content, "abstract");
assert_dict_has(force_langs, abstract_content, "abstract"); assert_dict_has(force_langs, abstract_content, "abstract");
if not is_none(keywords) { if not is_none(keywords) {
@@ -31,7 +39,7 @@
assert_not_none(author_gender, "author gender"); 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); 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);

View File

@@ -1,7 +1,7 @@
// tools & utils // tools & utils
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color #import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
#import "../lang.typ": lang_id, get_lang_item #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 // thesis types
#import "bp.typ": bp #import "bp.typ": bp
@@ -12,16 +12,21 @@
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, study_programme, abstract, keywords, title, author, author_gender, supervisor, study_programme, study_branch, abstract, keywords,
// content // content
content, content,
) = { ) = {
// argument pre-checking
let document_types = ( let document_types = (
"bp": bp, "bp": bp,
"other": other, "other": other,
) )
assert_in_dict(document_type, document_types, "document type"); 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)( document_types.at(document_type)(
faculty_id, faculty_id,
@@ -34,6 +39,7 @@
author_gender, author_gender,
supervisor, supervisor,
study_programme, study_programme,
study_branch,
abstract, abstract,
keywords, keywords,
content, content,

View File

@@ -75,7 +75,7 @@
faculty_id, faculty_id,
language, language,
document_type, document_type,
title, author, supervisor, study_programme, title, author, supervisor, study_programme, study_branch,
) = { ) = {
let info_name_value_padding = 5em; let info_name_value_padding = 5em;
let info_name_min_width = 10em; let info_name_min_width = 10em;
@@ -97,6 +97,7 @@
// [field_name, field_value, bold] // [field_name, field_value, bold]
let info_fields = ( let info_fields = (
("study_programme", study_programme, false), ("study_programme", study_programme, false),
("study_branch", study_branch, false),
( (
if not is_none(author) and author.contains(", ") {"authors" } else { "author" }, author, true if not is_none(author) and author.contains(", ") {"authors" } else { "author" }, author, true
), ),
@@ -135,9 +136,9 @@
faculty_id, faculty_id,
language, language,
document_type, 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); let nonetype = type(none);
page({ page({
if has_all_none(( if has_all_none((
@@ -148,8 +149,9 @@
header(faculty_id, language); header(faculty_id, language);
align({ align({
info( info(
faculty_id, language, document_type, title.at(language), faculty_id, language, document_type, map_none(title, (v) => v.at(language)),
author, supervisor, study_programme, author, supervisor, map_none(study_programme, (v) => v.at(language)),
map_none(study_branch, (v) => v.at(language)),
); );
v(5em); v(5em);
}, bottom); }, bottom);

View File

@@ -1,17 +1,26 @@
#import "../lang.typ": get_lang_item #import "../lang.typ": get_lang_item
#import "common.typ": mainpage, default_styling, assignment, disclaimer, abstract, toc, abbrlist #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( #let other(
// 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, _, supervisor, study_programme, abstract_content, keywords, title, author, _, supervisor, study_programme, study_branch, abstract_content, keywords,
content 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, { default_styling(true, faculty_color, {
toc(language); toc(language);
abbrlist(language); abbrlist(language);

View File

@@ -4,6 +4,7 @@
"authors": "Autoři", "authors": "Autoři",
"supervisor": "Vedoucí práce", "supervisor": "Vedoucí práce",
"study_programme": "Studijní program", "study_programme": "Studijní program",
"study_branch": "Studijní obor",
"bp": "Bakalářská práce", "bp": "Bakalářská práce",
"dp": "Diplomová práce", "dp": "Diplomová práce",
@@ -47,6 +48,7 @@
"authors": "Authors", "authors": "Authors",
"supervisor": "Supervisor", "supervisor": "Supervisor",
"study_programme": "Study programme", "study_programme": "Study programme",
"study_branch": "Study branch",
"bp": "Bachelor thesis", "bp": "Bachelor thesis",
"dp": "Diploma thesis", "dp": "Diploma thesis",

View File

@@ -41,7 +41,7 @@
// document info // document info
title: none, keywords: none, abstract: none, author: none, author_gender: none, title: none, keywords: none, abstract: none, author: none, author_gender: none,
supervisor: none, programme: none, supervisor: none, programme: none, branch: none,
// links // links
assignment: none, citations: "citations.bib", assignment: none, citations: "citations.bib",
@@ -67,6 +67,7 @@
assert_type_signature( assert_type_signature(
programme, "dictionary[string : string] | none", "study programme argument" 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(assignment, "string | none", "assignment document argument");
assert_type_signature(citations, "string", "citations file argument"); assert_type_signature(citations, "string", "citations file argument");
@@ -85,7 +86,7 @@
// template call // template call
templates.at(style)( templates.at(style)(
lang, faculty, document, citations, assignment, lang, faculty, document, citations, assignment,
title, author, author_gender, supervisor, programme, abstract, keywords, title, author, author_gender, supervisor, programme, branch, abstract, keywords,
content content
); );