extract arguments and add title pages disabling

This commit is contained in:
2025-10-10 17:42:03 +02:00
parent 3822ce3a98
commit 6e5604705e
8 changed files with 338 additions and 181 deletions

View File

@@ -2,52 +2,35 @@
#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, assert_dict_has
#import "../arguments.typ": req_arg, map_arg
#import "common.typ": default_styling
// thesis types
#import "bp.typ": bp
#import "dp.typ": dp
#import "other.typ": other
#let template_classic(
// general settings
language, faculty_id, document_type, citation_file, assignment_document,
#let template_classic(args, content) = {
let language = req_arg(args, "document.language");
// document info
title, author, author_pronouns, supervisor, consultant, study_programme, study_specialization,
year_of_study, abstract, acknowledgement, keywords,
// content
content,
) = {
// argument pre-checking
let document_types = (
"bp": bp,
"dp": dp,
"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_specialization, (v) => assert_dict_has((language,), v, "study specialization"));
map_none(acknowledgement, (v) => assert_dict_has((language,), v, "acknowledgement content"));
document_types.at(document_type)(
faculty_id,
faculty_color(faculty_id),
language,
map_none(assignment_document, (v) => "../../" + v),
map_none(citation_file, (v) => "../../" + v),
title,
author,
author_pronouns,
supervisor,
consultant,
study_programme,
study_specialization,
year_of_study,
abstract,
acknowledgement,
keywords,
content,
assert_in_dict(req_arg(args, "document.type"), document_types, "document type");
map_arg(args, "title", (v) => assert_dict_has((language,), v, "title"));
map_arg(args, "author.programme", (v) => assert_dict_has((language,), v, "study programme"));
map_arg(
args, "author.specialization", (v) => assert_dict_has((language,), v, "study specialization")
);
map_arg(
args, "acknowledgement", (v) => assert_dict_has((language,), v, "acknowledgement content")
);
args.assignment = map_arg(args, "assignment", (v) => "../../" + v);
args.citations = map_arg(args, "citations", (v) => "../../" + v);
document_types.at(req_arg(args, "document.type"))(args, content);
}