export title pages generation support

This commit is contained in:
2025-10-16 19:53:06 +02:00
parent a2b749e43d
commit eb60a4bb89
6 changed files with 87 additions and 18 deletions

View File

@@ -3,7 +3,7 @@
#import "common.typ": mainpage, assignment, external_title_pages
#import "thesis_base.typ": thesis_base
#let bp(args, content) = {
#let bp(args) = {
let language = req_arg(args, "document.language");
let programme = req_arg(args, "author.programme");
assert_dict_has((language,), programme, "study programme");
@@ -15,5 +15,4 @@
mainpage(args);
assignment(args);
thesis_base(args, content);
}

View File

@@ -8,18 +8,19 @@
// thesis types
#import "bp.typ": bp
#import "dp.typ": dp
#import "other.typ": other
#import "thesis_base.typ": thesis_base
#import "other.typ": other_title_page, other_base
#import "thesis_base.typ": thesis_base, thesis_base_title_pages
#let template_classic(args, content) = {
#let document_types = (
"bp": (bp, thesis_base, thesis_base_title_pages),
"dp": (dp, thesis_base, thesis_base_title_pages),
"other": (other_title_page, other_base, (args) => {}),
)
#let prep_args(args) = {
let language = req_arg(args, "document.language");
// argument pre-checking
let document_types = (
"bp": bp,
"dp": dp,
"other": other,
)
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"));
@@ -34,10 +35,24 @@
args.citations = map_arg(args, "citations", (v) => "../../" + v);
args.title_pages = map_arg(args, "title_pages", (v) => "../../" + v);
if not is_none(get_arg(args, "title_pages")) and not req_arg(args, "document.type") == "other" {
args
}
#let template_classic(args, content) = {
let args = prep_args(args);
if not is_none(get_arg(args, "title_pages")) {
external_title_pages(req_arg(args, "title_pages"));
thesis_base(args, content);
document_types.at(req_arg(args, "document.type")).at(1)(args, content);
} else {
document_types.at(req_arg(args, "document.type"))(args, content);
document_types.at(req_arg(args, "document.type")).at(0)(args);
document_types.at(req_arg(args, "document.type")).at(1)(args, content);
}
}
#let title_pages_classic(args) = {
let args = prep_args(args);
document_types.at(req_arg(args, "document.type")).at(0)(args);
document_types.at(req_arg(args, "document.type")).at(2)(args);
}

View File

@@ -3,7 +3,7 @@
#import "common.typ": mainpage, assignment, external_title_pages
#import "thesis_base.typ": thesis_base
#let dp(args, content) = {
#let dp(args) = {
let language = req_arg(args, "document.language");
let programme = req_arg(args, "author.programme");
assert_dict_has((language,), programme, "study programme");
@@ -16,5 +16,4 @@
mainpage(args);
assignment(args);
thesis_base(args, content);
}

View File

@@ -16,11 +16,15 @@
#import "../arguments.typ": req_arg
#import "../theme.typ": faculty_color
#let other(args, content) = {
#let other_title_page(args) = {
let (language, title) = req_arg(args, ("document.language", "title"));
assert_dict_has((language,), title, "title");
mainpage(args);
}
#let other_base(args, content) = {
let (language, title) = req_arg(args, ("document.language", "title"));
default_styling(true, faculty_color(req_arg(args, "document.faculty")), {
toc(language);
tablelist(language);

View File

@@ -14,8 +14,9 @@
)
#import "../attachments.typ": attachment_list
#let force_langs = ("cs", "en");
#let thesis_base(args, content) = {
let force_langs = ("cs", "en");
assert_dict_has(force_langs, req_arg(args, "title"), "title");
assert_dict_has(force_langs, req_arg(args, "abstract.content"), "abstract");
assert_dict_has(force_langs, req_arg(args, "abstract.keywords"), "keywords");
@@ -38,3 +39,12 @@
attachment_list(language);
}, language);
}
#let thesis_base_title_pages(args) = {
let language = req_arg(args, "document.language");
default_styling(false, faculty_color(req_arg(args, "document.faculty")), {
if is_none(get_arg(args, "title_pages")) {
disclaimer(args);
}
}, language);
}

View File

@@ -101,6 +101,48 @@
assert_release_ready();
}
#let tultitlepages2(
style: "classic", faculty: "tul", lang: "cs", document: "other",
title: none, author: none,
author_pronouns: none, supervisor: none, consultant: none, programme: none,
specialization: none, year_of_study: none,
) = {
import "arguments.typ": (
arguments,
document_info,
author_info,
project_info,
abstract_info,
check_arguments,
req_arg,
)
let args = arguments(
document_info(style, faculty, lang, document),
none,
title,
author_info(author, author_pronouns, programme, specialization, year_of_study),
project_info(supervisor, consultant),
abstract_info(none, none),
none,
none,
"",
);
check_arguments(args);
import "utils.typ": assert_in_dict, assert_type_signature
import "classic/classic.typ": title_pages_classic
let title_pages = (
classic: title_pages_classic,
);
assert_in_dict(style, title_pages, "template name");
import "lang.typ": lang_ids
assert_in_dict(lang, lang_ids, "language abbreviation");
set text(lang: lang);
title_pages.at(style)(args);
}
// Make a new abbreviation
//
// - abbreviation (str): The abbreviation