Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
c8d42664a9
|
|||
497dbd270d
|
|||
c63864159a
|
|||
0ae7db2cd3
|
|||
79df0d4dd9
|
|||
6e5604705e
|
|||
3822ce3a98
|
|||
bfa2fedefb
|
|||
8666604e8c
|
|||
a0eb5f4ed0
|
10
Makefile
10
Makefile
@@ -21,8 +21,8 @@ PACKDIR := pack/tultemplate2
|
|||||||
BUNDLEDIR := pack/bundle
|
BUNDLEDIR := pack/bundle
|
||||||
|
|
||||||
TO_PACK := $(shell find template -type f) template/LICENSE
|
TO_PACK := $(shell find template -type f) template/LICENSE
|
||||||
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp.typ \
|
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp_cs.typ \
|
||||||
$(BUNDLEDIR)/dp.typ $(BUNDLEDIR)/Makefile
|
$(BUNDLEDIR)/bp_en.typ $(BUNDLEDIR)/dp_cs.typ $(BUNDLEDIR)/Makefile
|
||||||
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
|
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
|
||||||
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib
|
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib
|
||||||
|
|
||||||
@@ -51,11 +51,7 @@ $(BUNDLEDIR)/citations.bib: citations.bib
|
|||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
|
||||||
$(BUNDLEDIR)/bp.typ: theses/bp.typ
|
$(BUNDLEDIR)/%.typ: theses/%.typ
|
||||||
@mkdir -p $(@D)
|
|
||||||
awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' $< | sed 's/\.\.\/template\//template\//' > $@
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/dp.typ: theses/dp.typ
|
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' $< | sed 's/\.\.\/template\//template\//' > $@
|
awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' $< | sed 's/\.\.\/template\//template\//' > $@
|
||||||
|
|
||||||
|
@@ -222,6 +222,19 @@ zrakovým postižením).
|
|||||||
|
|
||||||
Tabulky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje).
|
Tabulky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje).
|
||||||
|
|
||||||
|
== Poznámky pod čarou
|
||||||
|
|
||||||
|
Poznámky pod čarou jsou způsob sdělení dodatečných informácí, které pro čtenáře běžně nebudou velmi
|
||||||
|
podstatné. Mohou sloužit například k upřesnění informací. #footnote[Nebo k doplnění technikálií]
|
||||||
|
|
||||||
|
Poznámka pod čarou se vytvoří následovně:
|
||||||
|
|
||||||
|
```typst
|
||||||
|
#footnote[Moje poznámka]
|
||||||
|
```
|
||||||
|
|
||||||
|
Šablona automaticky vytvoří čáru s barvou vaší fakulty a pod ní vloží poznámky na dané straně.
|
||||||
|
|
||||||
== Citace
|
== Citace
|
||||||
|
|
||||||
Šablona podporuje správu citací pomocí standardního BibTeX @bibtex souboru, stejně jako
|
Šablona podporuje správu citací pomocí standardního BibTeX @bibtex souboru, stejně jako
|
||||||
|
@@ -18,10 +18,11 @@
|
|||||||
}
|
}
|
||||||
"(" + abbrs.pairs().map((v) => { v.at(0) + ":\"" + v.at(1) + "\"" }).join(",") + ")"
|
"(" + abbrs.pairs().map((v) => { v.at(0) + ":\"" + v.at(1) + "\"" }).join(",") + ")"
|
||||||
});
|
});
|
||||||
|
let target_label = label("abbr_" + abbreviation);
|
||||||
if type(text) != type(none) {
|
if type(text) != type(none) {
|
||||||
text + " (" + abbreviation + ")";
|
link(target_label, text + " (" + abbreviation + ")");
|
||||||
} else {
|
} else {
|
||||||
abbreviation;
|
link(target_label, abbreviation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
174
template/arguments.typ
Normal file
174
template/arguments.typ
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
#import "utils.typ": assert_type_signature, is_none, map_none, deref
|
||||||
|
|
||||||
|
#let arguments_structure = (
|
||||||
|
document: (
|
||||||
|
visual_style: "string",
|
||||||
|
faculty: "string",
|
||||||
|
language: "string",
|
||||||
|
type: "string",
|
||||||
|
),
|
||||||
|
title_pages: "string | boolean | none",
|
||||||
|
title: "dictionary[string : string] | none",
|
||||||
|
author: (
|
||||||
|
name: "string | none",
|
||||||
|
pronouns: "string | none",
|
||||||
|
programme: "dictionary[string : string] | none",
|
||||||
|
specialization: "dictionary[string : string] | none",
|
||||||
|
year_of_study: "integer | none",
|
||||||
|
),
|
||||||
|
project: (
|
||||||
|
supervisor: "string | dictionary[string : string] | none",
|
||||||
|
consultant: "string | dictionary[string : string] | none",
|
||||||
|
),
|
||||||
|
abstract: (
|
||||||
|
content: "dictionary[string : string | content] | none",
|
||||||
|
keywords: "dictionary[string : array[string]] | none",
|
||||||
|
),
|
||||||
|
acknowledgement: "dictionary[string : string | content] | none",
|
||||||
|
assignment: "string | none",
|
||||||
|
citations: "string",
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#let check_arguments(args) = {
|
||||||
|
let check_arguments_dict(structure, args, argument_path) = {
|
||||||
|
for (key, value) in structure.pairs() {
|
||||||
|
argument_path.push(str(key).replace("_", " "));
|
||||||
|
|
||||||
|
if not key in args {
|
||||||
|
panic("invalid arguments definition");
|
||||||
|
}
|
||||||
|
let arg = args.at(key);
|
||||||
|
|
||||||
|
if type(value) == dictionary {
|
||||||
|
check_arguments_dict(value, arg, argument_path);
|
||||||
|
} else if type(value) == str {
|
||||||
|
assert_type_signature(arg, value, argument_path.join(" "));
|
||||||
|
} else {
|
||||||
|
panic("invalid arguments definition");
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = argument_path.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
check_arguments_dict(arguments_structure, args, ());
|
||||||
|
}
|
||||||
|
|
||||||
|
#let get_arg_single(args, path) = {
|
||||||
|
let args = args;
|
||||||
|
for segment in path.split(".") {
|
||||||
|
if segment not in args {
|
||||||
|
panic("invalid argument query path: " + str(path));
|
||||||
|
}
|
||||||
|
args = args.at(segment);
|
||||||
|
}
|
||||||
|
args
|
||||||
|
}
|
||||||
|
|
||||||
|
#let get_arg(args, path) = {
|
||||||
|
if type(path) == array {
|
||||||
|
let res = ();
|
||||||
|
for path in path {
|
||||||
|
res.push(get_arg_single(args, path));
|
||||||
|
}
|
||||||
|
res
|
||||||
|
} else if type(path) == str {
|
||||||
|
get_arg_single(args, path)
|
||||||
|
} else {
|
||||||
|
panic("invalid argument path");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#let req_arg_single(args, path) = {
|
||||||
|
let arg = get_arg_single(args, path);
|
||||||
|
if is_none(arg) {
|
||||||
|
let panic_message = path.split(".").join(" ").replace("_", " ") + " is missing";
|
||||||
|
panic(panic_message);
|
||||||
|
}
|
||||||
|
arg
|
||||||
|
}
|
||||||
|
|
||||||
|
#let req_arg(args, path) = {
|
||||||
|
if type(path) == array {
|
||||||
|
let res = ();
|
||||||
|
for path in path {
|
||||||
|
res.push(req_arg_single(args, path));
|
||||||
|
}
|
||||||
|
res
|
||||||
|
} else if type(path) == str {
|
||||||
|
req_arg_single(args, path)
|
||||||
|
} else {
|
||||||
|
panic("invalid argument path");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#let map_arg_single(args, path, mapper) = {
|
||||||
|
let arg = get_arg(args, path);
|
||||||
|
map_none(arg, mapper)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let map_arg(args, path, mapper) = {
|
||||||
|
if type(path) == array {
|
||||||
|
let res = ();
|
||||||
|
for path in path {
|
||||||
|
res.push(map_arg_single(args, path, mapper));
|
||||||
|
}
|
||||||
|
res
|
||||||
|
} else if type(path) == str {
|
||||||
|
map_arg_single(args, path, mapper)
|
||||||
|
} else {
|
||||||
|
panic("invalid argument path");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#let arguments(
|
||||||
|
document_info,
|
||||||
|
title_pages,
|
||||||
|
title,
|
||||||
|
author_info,
|
||||||
|
project_info,
|
||||||
|
abstract_info,
|
||||||
|
acknowledgement,
|
||||||
|
assignment,
|
||||||
|
citations,
|
||||||
|
) = {
|
||||||
|
(
|
||||||
|
document: document_info,
|
||||||
|
title_pages: title_pages,
|
||||||
|
title: title,
|
||||||
|
author: author_info,
|
||||||
|
project: project_info,
|
||||||
|
abstract: abstract_info,
|
||||||
|
acknowledgement: acknowledgement,
|
||||||
|
assignment: assignment,
|
||||||
|
citations: citations,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let document_info(visual_style, faculty_abbreviation, language_abbreviation, document_type) = {
|
||||||
|
(
|
||||||
|
visual_style: visual_style,
|
||||||
|
faculty: faculty_abbreviation,
|
||||||
|
language: language_abbreviation,
|
||||||
|
type: document_type,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let author_info(name, pronouns, programme, specialization, year_of_study) = {
|
||||||
|
(
|
||||||
|
name: name,
|
||||||
|
pronouns: pronouns,
|
||||||
|
programme: programme,
|
||||||
|
specialization: specialization,
|
||||||
|
year_of_study: year_of_study,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let project_info(supervisor, consultant) = {
|
||||||
|
(supervisor: supervisor, consultant: consultant)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let abstract_info(abstract, keywords) = {
|
||||||
|
(content: abstract, keywords: keywords)
|
||||||
|
}
|
@@ -1,74 +1,19 @@
|
|||||||
#import "../lang.typ": get_lang_item
|
#import "../arguments.typ": req_arg, get_arg
|
||||||
#import "common.typ": (
|
#import "../utils.typ": assert_dict_has, is_none
|
||||||
mainpage,
|
#import "common.typ": mainpage, assignment, external_title_pages
|
||||||
default_styling,
|
#import "thesis_base.typ": thesis_base
|
||||||
assignment,
|
|
||||||
disclaimer,
|
|
||||||
abstract,
|
|
||||||
acknowledgement,
|
|
||||||
toc,
|
|
||||||
abbrlist,
|
|
||||||
imagelist,
|
|
||||||
tablelist,
|
|
||||||
bibliogr
|
|
||||||
)
|
|
||||||
#import "../attachments.typ": attachment_list
|
|
||||||
#import "../utils.typ": is_none, assert_dict_has, assert_not_none, assert_type_signature
|
|
||||||
|
|
||||||
#let bp(
|
#let bp(args, content) = {
|
||||||
// general settings
|
let language = req_arg(args, "document.language");
|
||||||
faculty_id, faculty_color, language, assignment_document, citation_file,
|
let programme = req_arg(args, "author.programme");
|
||||||
|
assert_dict_has((language,), programme, "study programme");
|
||||||
// document info
|
let specialization = req_arg(args, "author.specialization");
|
||||||
title, author, author_pronouns, supervisor, consultant, study_programme, study_specialization,
|
assert_dict_has((language,), specialization, "study specialization");
|
||||||
year_of_study, abstract_content, acknowledgement_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_specialization, "study specialization");
|
|
||||||
assert_dict_has((language,), study_specialization, "study specialization");
|
|
||||||
|
|
||||||
assert_not_none(abstract_content, "abstract");
|
|
||||||
assert_dict_has(force_langs, abstract_content, "abstract");
|
|
||||||
if not is_none(keywords) {
|
|
||||||
assert_dict_has(force_langs, keywords, "keywords");
|
|
||||||
}
|
|
||||||
if language == "cs" {
|
if language == "cs" {
|
||||||
assert_not_none(author_pronouns, "author gender");
|
let _ = req_arg(args, "author.pronouns");
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_type_signature(supervisor, "string | none", "supervisor");
|
mainpage(args);
|
||||||
assert_type_signature(consultant, "string | none", "consultant");
|
assignment(args);
|
||||||
|
thesis_base(args, content);
|
||||||
mainpage(
|
|
||||||
faculty_id, language, "bp", title, author, supervisor, consultant, study_programme,
|
|
||||||
study_specialization, year_of_study,
|
|
||||||
);
|
|
||||||
assignment(language, assignment_document);
|
|
||||||
default_styling(false, faculty_color, {
|
|
||||||
disclaimer(language, faculty_id, "bp", author, author_pronouns);
|
|
||||||
if language == "cs" {
|
|
||||||
abstract("cs", title, abstract_content, keywords);
|
|
||||||
abstract("en", title, abstract_content, keywords);
|
|
||||||
}
|
|
||||||
if language == "en" {
|
|
||||||
abstract("en", title, abstract_content, keywords);
|
|
||||||
abstract("cs", title, abstract_content, keywords);
|
|
||||||
}
|
|
||||||
acknowledgement(language, author, acknowledgement_content);
|
|
||||||
toc(language);
|
|
||||||
tablelist(language);
|
|
||||||
imagelist(language);
|
|
||||||
abbrlist(language);
|
|
||||||
pagebreak(weak: true);
|
|
||||||
content;
|
|
||||||
bibliogr(language, citation_file);
|
|
||||||
attachment_list(language);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@@ -1,53 +1,43 @@
|
|||||||
// 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, assert_dict_has
|
#import "../utils.typ": assert_in_dict, assert_in_arr, map_none, assert_dict_has, is_none
|
||||||
|
#import "../arguments.typ": req_arg, map_arg, get_arg
|
||||||
|
#import "common.typ": default_styling, external_title_pages
|
||||||
|
|
||||||
// thesis types
|
// thesis types
|
||||||
#import "bp.typ": bp
|
#import "bp.typ": bp
|
||||||
#import "dp.typ": dp
|
#import "dp.typ": dp
|
||||||
#import "other.typ": other
|
#import "other.typ": other
|
||||||
|
#import "thesis_base.typ": thesis_base
|
||||||
|
|
||||||
#let template_classic(
|
#let template_classic(args, content) = {
|
||||||
// general settings
|
let language = req_arg(args, "document.language");
|
||||||
language, faculty_id, document_type, citation_file, assignment_document,
|
|
||||||
|
|
||||||
// document info
|
|
||||||
title, author, author_pronouns, supervisor, consultant, study_programme, study_specialization,
|
|
||||||
year_of_study, abstract, acknowledgement, keywords,
|
|
||||||
|
|
||||||
// content
|
|
||||||
content,
|
|
||||||
) = {
|
|
||||||
// argument pre-checking
|
// argument pre-checking
|
||||||
let document_types = (
|
let document_types = (
|
||||||
"bp": bp,
|
"bp": bp,
|
||||||
"dp": dp,
|
"dp": dp,
|
||||||
"other": other,
|
"other": other,
|
||||||
)
|
)
|
||||||
assert_in_dict(document_type, document_types, "document type");
|
assert_in_dict(req_arg(args, "document.type"), document_types, "document type");
|
||||||
map_none(title, (v) => assert_dict_has((language,), v, "title"));
|
map_arg(args, "title", (v) => assert_dict_has((language,), v, "title"));
|
||||||
map_none(study_programme, (v) => assert_dict_has((language,), v, "study programme"));
|
map_arg(args, "author.programme", (v) => assert_dict_has((language,), v, "study programme"));
|
||||||
map_none(study_specialization, (v) => assert_dict_has((language,), v, "study specialization"));
|
map_arg(
|
||||||
map_none(acknowledgement, (v) => assert_dict_has((language,), v, "acknowledgement content"));
|
args, "author.specialization", (v) => assert_dict_has((language,), v, "study specialization")
|
||||||
|
|
||||||
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,
|
|
||||||
);
|
);
|
||||||
|
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);
|
||||||
|
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" {
|
||||||
|
external_title_pages(req_arg(args, "title_pages"));
|
||||||
|
thesis_base(args, content);
|
||||||
|
} else {
|
||||||
|
document_types.at(req_arg(args, "document.type"))(args, content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
|
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
|
||||||
#import "../lang.typ": get_lang_item
|
#import "../lang.typ": get_lang_item, set_czech_nonbreakable_terms
|
||||||
#import "../utils.typ": is_none, assert_dict_has, map_none
|
#import "../utils.typ": is_none, assert_dict_has, has_all_none, map_none
|
||||||
|
#import "../arguments.typ": req_arg, get_arg
|
||||||
|
|
||||||
#let base_font = "Inter";
|
#let base_font = "Inter";
|
||||||
#let mono_font = "Noto Sans Mono";
|
#let mono_font = "Noto Sans Mono";
|
||||||
#let mono_font_compensation = 1.3em;
|
#let mono_font_compensation = 1.3010575323879552;
|
||||||
#let serif_font = "Merriweather";
|
#let serif_font = "Merriweather";
|
||||||
#let tul_logomark_size = 6.5em;
|
#let tul_logomark_size = 6.5em;
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
|
|
||||||
// TYPST ELEMENT STYLING
|
// TYPST ELEMENT STYLING
|
||||||
|
|
||||||
#let default_styling(flip_bonding, faculty_color, content) = {
|
#let default_styling(flip_bonding, faculty_color, content, language) = {
|
||||||
// page
|
// page
|
||||||
set page(
|
set page(
|
||||||
margin: if flip_bonding {
|
margin: if flip_bonding {
|
||||||
@@ -37,6 +38,9 @@
|
|||||||
// text
|
// text
|
||||||
set text(font: serif_font);
|
set text(font: serif_font);
|
||||||
set par(justify: true, first-line-indent: 0.63cm);
|
set par(justify: true, first-line-indent: 0.63cm);
|
||||||
|
if language == "cs" {
|
||||||
|
content = set_czech_nonbreakable_terms(content);
|
||||||
|
}
|
||||||
|
|
||||||
// figures
|
// figures
|
||||||
let figure_numbering(realcount, c) = {
|
let figure_numbering(realcount, c) = {
|
||||||
@@ -79,7 +83,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// other
|
// other
|
||||||
show raw: set text(font: mono_font, size: mono_font_compensation);
|
show raw: set text(font: mono_font, size: mono_font_compensation * 1em);
|
||||||
show raw.where(block: true): it => {
|
show raw.where(block: true): it => {
|
||||||
block(it, fill: rgb("#eee"), inset: 1em)
|
block(it, fill: rgb("#eee"), inset: 1em)
|
||||||
};
|
};
|
||||||
@@ -142,7 +146,7 @@
|
|||||||
let gutter = .7em;
|
let gutter = .7em;
|
||||||
|
|
||||||
// document type
|
// document type
|
||||||
if type(document_type) != type(none) {
|
if document_type != "other" {
|
||||||
text(get_lang_item(language, document_type), weight: "bold", font: base_font);
|
text(get_lang_item(language, document_type), weight: "bold", font: base_font);
|
||||||
v(0em);
|
v(0em);
|
||||||
}
|
}
|
||||||
@@ -193,24 +197,32 @@
|
|||||||
|
|
||||||
// MAINPAGE
|
// MAINPAGE
|
||||||
|
|
||||||
#let mainpage(
|
#let mainpage(args) = {
|
||||||
faculty_id,
|
let (
|
||||||
language,
|
language, document_type, faculty,
|
||||||
document_type,
|
|
||||||
title, author, supervisor, consultant, study_programme, study_specialization, year_of_study,
|
title, author, supervisor, consultant, study_programme, study_specialization, year_of_study,
|
||||||
) = {
|
) = get_arg(args, (
|
||||||
import "../utils.typ": has_all_none, map_none
|
"document.language",
|
||||||
let nonetype = type(none);
|
"document.type",
|
||||||
|
"document.faculty",
|
||||||
|
"title",
|
||||||
|
"author.name",
|
||||||
|
"project.supervisor",
|
||||||
|
"project.consultant",
|
||||||
|
"author.programme",
|
||||||
|
"author.specialization",
|
||||||
|
"author.year_of_study",
|
||||||
|
));
|
||||||
page({
|
page({
|
||||||
if has_all_none((
|
if has_all_none((
|
||||||
document_type, title, author, supervisor, consultant, study_programme,
|
document_type, title, author, supervisor, consultant, study_programme,
|
||||||
)) {
|
)) {
|
||||||
place(center + horizon, align(left, faculty_logotype(faculty_id, language)));
|
place(center + horizon, align(left, faculty_logotype(faculty_id, language)));
|
||||||
} else {
|
} else {
|
||||||
header(faculty_id, language);
|
header(faculty, language);
|
||||||
align({
|
align({
|
||||||
info(
|
info(
|
||||||
faculty_id, language, document_type, map_none(title, (v) => v.at(language)),
|
faculty, language, document_type, map_none(title, (v) => v.at(language)),
|
||||||
author, supervisor, consultant, map_none(study_programme, (v) => v.at(language)),
|
author, supervisor, consultant, map_none(study_programme, (v) => v.at(language)),
|
||||||
map_none(study_specialization, (v) => v.at(language)), year_of_study,
|
map_none(study_specialization, (v) => v.at(language)), year_of_study,
|
||||||
);
|
);
|
||||||
@@ -220,13 +232,21 @@
|
|||||||
}, margin: 2cm);
|
}, margin: 2cm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _ EMBEDDED
|
||||||
|
|
||||||
|
#let pdfembed(path) = {
|
||||||
|
import "@preview/muchpdf:0.1.1": muchpdf
|
||||||
|
set page(margin: 0em);
|
||||||
|
muchpdf(read(path, encoding: none));
|
||||||
|
}
|
||||||
|
|
||||||
// ASSIGNMENT PAGE
|
// ASSIGNMENT PAGE
|
||||||
|
|
||||||
#let assignment(language, document) = {
|
#let assignment(args) = {
|
||||||
if type(document) == type(none) {
|
if is_none(get_arg(args, "assignment")) {
|
||||||
page(
|
page(
|
||||||
place(center + horizon, text(
|
place(center + horizon, text(
|
||||||
get_lang_item(language, "place_assignment"),
|
get_lang_item(req_arg(args, "document.language"), "place_assignment"),
|
||||||
fill: red,
|
fill: red,
|
||||||
size: 3em,
|
size: 3em,
|
||||||
font: base_font,
|
font: base_font,
|
||||||
@@ -237,15 +257,26 @@
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
import "@preview/muchpdf:0.1.1": muchpdf
|
pdfembed(req_arg(args, "assignment"))
|
||||||
set page(margin: 0em);
|
}
|
||||||
muchpdf(read(document, encoding: none));
|
|
||||||
|
// EXTERNAL TITLE PAGES
|
||||||
|
|
||||||
|
#let external_title_pages(path) = {
|
||||||
|
pdfembed(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DISCLAIMER PAGE
|
// DISCLAIMER PAGE
|
||||||
|
|
||||||
#let disclaimer(language, faculty_id, disclaimer_type, author, author_pronouns) = {
|
#let disclaimer(args) = {
|
||||||
import "../lang.typ": disclaimer
|
import "../lang.typ": disclaimer
|
||||||
|
let (language, faculty, disclaimer_type, author, author_pronouns) = req_arg(args, (
|
||||||
|
"document.language",
|
||||||
|
"document.faculty",
|
||||||
|
"document.type",
|
||||||
|
"author.name",
|
||||||
|
"author.pronouns",
|
||||||
|
));
|
||||||
heading(get_lang_item(language, "disclaimer"), numbering: none, outlined: false);
|
heading(get_lang_item(language, "disclaimer"), numbering: none, outlined: false);
|
||||||
par(
|
par(
|
||||||
text(disclaimer(language, disclaimer_type, author_pronouns))
|
text(disclaimer(language, disclaimer_type, author_pronouns))
|
||||||
@@ -263,7 +294,9 @@
|
|||||||
|
|
||||||
// ACKNOWLEDGEMENT PAGE
|
// ACKNOWLEDGEMENT PAGE
|
||||||
|
|
||||||
#let acknowledgement(language, author, content) = {
|
#let acknowledgement(args) = {
|
||||||
|
let content = get_arg(args, "acknowledgement");
|
||||||
|
let (language, author) = req_arg(args, ("document.language", "author.name"));
|
||||||
if is_none(content) {
|
if is_none(content) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -275,8 +308,10 @@
|
|||||||
|
|
||||||
// ABSTRACT
|
// ABSTRACT
|
||||||
|
|
||||||
#let abstract(language, title, content, keywords) = {
|
#let abstract(language, args) = {
|
||||||
heading(text(title.at(language), font: base_font), numbering: none, outlined: false);
|
heading(
|
||||||
|
text(req_arg(args, "title").at(language), font: base_font), numbering: none, outlined: false
|
||||||
|
);
|
||||||
v(2em);
|
v(2em);
|
||||||
heading(
|
heading(
|
||||||
level: 2,
|
level: 2,
|
||||||
@@ -284,7 +319,8 @@
|
|||||||
numbering: none,
|
numbering: none,
|
||||||
outlined: false,
|
outlined: false,
|
||||||
);
|
);
|
||||||
text(content.at(language));
|
text(req_arg(args, "abstract.content").at(language));
|
||||||
|
let keywords = get_arg(args, "abstract.keywords");
|
||||||
if not is_none(keywords) and type(keywords.at(language)) != type(none) {
|
if not is_none(keywords) and type(keywords.at(language)) != type(none) {
|
||||||
linebreak();
|
linebreak();
|
||||||
linebreak();
|
linebreak();
|
||||||
@@ -364,7 +400,12 @@
|
|||||||
gutter: 1em,
|
gutter: 1em,
|
||||||
..abbrs.pairs().map((a) => {
|
..abbrs.pairs().map((a) => {
|
||||||
(
|
(
|
||||||
align(left, block(text(a.at(0), weight: "bold"), width: max_abbr_width + 1em)),
|
align(left, {
|
||||||
|
[
|
||||||
|
#block(text(a.at(0), weight: "bold"), width: max_abbr_width + 1em)
|
||||||
|
#label("abbr_" + a.at(0))
|
||||||
|
]
|
||||||
|
}),
|
||||||
text(a.at(1))
|
text(a.at(1))
|
||||||
)
|
)
|
||||||
}).flatten()
|
}).flatten()
|
||||||
@@ -384,7 +425,8 @@
|
|||||||
|
|
||||||
// BIBLIOGRAPHY
|
// BIBLIOGRAPHY
|
||||||
|
|
||||||
#let bibliogr(language, citations_file) = {
|
#let bibliogr(args) = {
|
||||||
|
let (language, citations_file) = req_arg(args, ("document.language", "citations"));
|
||||||
if language == "cs" {
|
if language == "cs" {
|
||||||
bibliography(
|
bibliography(
|
||||||
citations_file, style: "../tul_citace.csl", title: get_lang_item(language, "bibliography"),
|
citations_file, style: "../tul_citace.csl", title: get_lang_item(language, "bibliography"),
|
||||||
|
@@ -1,67 +1,20 @@
|
|||||||
#import "../lang.typ": get_lang_item
|
#import "../arguments.typ": req_arg, get_arg, map_arg
|
||||||
#import "common.typ": (
|
#import "../utils.typ": assert_dict_has, is_none
|
||||||
mainpage,
|
#import "common.typ": mainpage, assignment, external_title_pages
|
||||||
default_styling,
|
#import "thesis_base.typ": thesis_base
|
||||||
assignment,
|
|
||||||
disclaimer,
|
|
||||||
abstract,
|
|
||||||
acknowledgement,
|
|
||||||
toc,
|
|
||||||
abbrlist,
|
|
||||||
imagelist,
|
|
||||||
tablelist,
|
|
||||||
bibliogr
|
|
||||||
)
|
|
||||||
#import "../attachments.typ": attachment_list
|
|
||||||
#import "../utils.typ": is_none, assert_dict_has, assert_not_none, assert_type_signature, map_none
|
|
||||||
|
|
||||||
#let dp(
|
#let dp(args, content) = {
|
||||||
// general settings
|
let language = req_arg(args, "document.language");
|
||||||
faculty_id, faculty_color, language, assignment_document, citation_file,
|
let programme = req_arg(args, "author.programme");
|
||||||
|
assert_dict_has((language,), programme, "study programme");
|
||||||
// document info
|
map_arg(args, "author.specialization", (v) => {
|
||||||
title, author, author_pronouns, supervisor, consultant, study_programme, study_specialization,
|
assert_dict_has((language,), v, "study specialization");
|
||||||
year_of_study, abstract_content, acknowledgement_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");
|
|
||||||
map_none(study_specialization, (v) => assert_dict_has((language,), v, "study specialization"));
|
|
||||||
|
|
||||||
assert_not_none(abstract_content, "abstract");
|
|
||||||
assert_dict_has(force_langs, abstract_content, "abstract");
|
|
||||||
if not is_none(keywords) {
|
|
||||||
assert_dict_has(force_langs, keywords, "keywords");
|
|
||||||
}
|
|
||||||
if language == "cs" {
|
|
||||||
assert_not_none(author_pronouns, "author gender");
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_type_signature(supervisor, "string | none", "supervisor");
|
|
||||||
assert_type_signature(consultant, "string | none", "consultant");
|
|
||||||
|
|
||||||
mainpage(
|
|
||||||
faculty_id, language, "dp", title, author, supervisor, consultant, study_programme,
|
|
||||||
study_specialization, year_of_study,
|
|
||||||
);
|
|
||||||
assignment(language, assignment_document);
|
|
||||||
default_styling(false, faculty_color, {
|
|
||||||
disclaimer(language, faculty_id, "dp", author, author_pronouns);
|
|
||||||
abstract("cs", title, abstract_content, keywords);
|
|
||||||
abstract("en", title, abstract_content, keywords);
|
|
||||||
acknowledgement(language, author, acknowledgement_content);
|
|
||||||
toc(language);
|
|
||||||
tablelist(language);
|
|
||||||
imagelist(language);
|
|
||||||
abbrlist(language);
|
|
||||||
pagebreak(weak: true);
|
|
||||||
content;
|
|
||||||
bibliogr(language, citation_file);
|
|
||||||
attachment_list(language);
|
|
||||||
});
|
});
|
||||||
|
if language == "cs" {
|
||||||
|
let _ = req_arg(args, "author.pronouns");
|
||||||
|
}
|
||||||
|
|
||||||
|
mainpage(args);
|
||||||
|
assignment(args);
|
||||||
|
thesis_base(args, content);
|
||||||
}
|
}
|
||||||
|
@@ -13,32 +13,22 @@
|
|||||||
)
|
)
|
||||||
#import "../attachments.typ": attachment_list
|
#import "../attachments.typ": attachment_list
|
||||||
#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr
|
#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr
|
||||||
|
#import "../arguments.typ": req_arg
|
||||||
|
#import "../theme.typ": faculty_color
|
||||||
|
|
||||||
#let other(
|
#let other(args, content) = {
|
||||||
// general settings
|
let (language, title) = req_arg(args, ("document.language", "title"));
|
||||||
faculty_id, faculty_color, language, assignment_document, citation_file,
|
|
||||||
|
|
||||||
// document info
|
|
||||||
title, author, _, supervisor, consultant, study_programme, study_specialization, year_of_study,
|
|
||||||
abstract_content, _, keywords,
|
|
||||||
|
|
||||||
content
|
|
||||||
) = {
|
|
||||||
assert_not_none(title, "title");
|
|
||||||
assert_dict_has((language,), title, "title");
|
assert_dict_has((language,), title, "title");
|
||||||
|
|
||||||
mainpage(
|
mainpage(args);
|
||||||
faculty_id, language, none, title, author, supervisor, consultant, study_programme,
|
default_styling(true, faculty_color(req_arg(args, "document.faculty")), {
|
||||||
study_specialization, year_of_study,
|
|
||||||
);
|
|
||||||
default_styling(true, faculty_color, {
|
|
||||||
toc(language);
|
toc(language);
|
||||||
tablelist(language);
|
tablelist(language);
|
||||||
imagelist(language);
|
imagelist(language);
|
||||||
abbrlist(language);
|
abbrlist(language);
|
||||||
pagebreak(to: "even", weak: true);
|
pagebreak(to: "even", weak: true);
|
||||||
content;
|
content;
|
||||||
bibliogr(language, citation_file);
|
bibliogr(args);
|
||||||
attachment_list(language);
|
attachment_list(language);
|
||||||
});
|
}, language);
|
||||||
}
|
}
|
||||||
|
40
template/classic/thesis_base.typ
Normal file
40
template/classic/thesis_base.typ
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#import "../theme.typ": faculty_color
|
||||||
|
#import "../arguments.typ": get_arg, req_arg
|
||||||
|
#import "../utils.typ": is_none, assert_dict_has
|
||||||
|
#import "common.typ": (
|
||||||
|
default_styling,
|
||||||
|
disclaimer,
|
||||||
|
abstract,
|
||||||
|
acknowledgement,
|
||||||
|
toc,
|
||||||
|
tablelist,
|
||||||
|
imagelist,
|
||||||
|
abbrlist,
|
||||||
|
bibliogr,
|
||||||
|
)
|
||||||
|
#import "../attachments.typ": attachment_list
|
||||||
|
|
||||||
|
#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");
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
abstract("cs", args);
|
||||||
|
abstract("en", args);
|
||||||
|
acknowledgement(args);
|
||||||
|
toc(language);
|
||||||
|
tablelist(language);
|
||||||
|
imagelist(language);
|
||||||
|
abbrlist(language);
|
||||||
|
pagebreak(weak: true);
|
||||||
|
content;
|
||||||
|
bibliogr(args);
|
||||||
|
attachment_list(language);
|
||||||
|
}, language);
|
||||||
|
}
|
@@ -45,6 +45,34 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#let set_czech_nonbreakable_terms(content) = {
|
||||||
|
let space_after = (
|
||||||
|
"[kosuvzai]",
|
||||||
|
"(tj|tzv|tzn)\.",
|
||||||
|
);
|
||||||
|
show regex("\b((?i)(" + space_after.join("|") + ") )+\w+\b"): match => {
|
||||||
|
box(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
let nonbreaking_abbreviations = (
|
||||||
|
"a. s",
|
||||||
|
"s. r. o",
|
||||||
|
"v. o. s",
|
||||||
|
"k. s",
|
||||||
|
"n. p",
|
||||||
|
"p. o",
|
||||||
|
"č. ([pe]|ev)",
|
||||||
|
"ev?. č",
|
||||||
|
);
|
||||||
|
show regex(
|
||||||
|
"(?i)\b(" + nonbreaking_abbreviations.map((v) => { v.replace(".", "\\.") }).join("|") + ")\."
|
||||||
|
): match => {
|
||||||
|
box(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
content
|
||||||
|
}
|
||||||
|
|
||||||
#let disclaimer(language, document_type, author_pronouns) = {
|
#let disclaimer(language, document_type, author_pronouns) = {
|
||||||
let disclaimer = get_lang_item(language, "disclaimer_content");
|
let disclaimer = get_lang_item(language, "disclaimer_content");
|
||||||
let replacements = get_lang_item(language, "disclaimer_replace").at(document_type);
|
let replacements = get_lang_item(language, "disclaimer_replace").at(document_type);
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
// - faculty (str): Factulty abbreviation. One of "fs", "ft", "fp", "ef", "fua", "fm", "fzs", "cxi".
|
// - faculty (str): Factulty abbreviation. One of "fs", "ft", "fp", "ef", "fua", "fm", "fzs", "cxi".
|
||||||
// - lang (str): Language code. This can be "cs" or "en".
|
// - lang (str): Language code. This can be "cs" or "en".
|
||||||
// - document (str): Type of document. This can be "bp" or "other".
|
// - document (str): Type of document. This can be "bp" or "other".
|
||||||
|
// - title_pages (str): The title pages exported from STAG (supported for some document types)
|
||||||
// - title (dictionary): The title of the document.
|
// - title (dictionary): The title of the document.
|
||||||
// - author (str): The name of the document's author.
|
// - author (str): The name of the document's author.
|
||||||
// - author_pronouns (str): The gender of the document's author. Needed only for the `cs` language.
|
// - author_pronouns (str): The gender of the document's author. Needed only for the `cs` language.
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
style: "classic", faculty: "tul", lang: "cs", document: "other",
|
style: "classic", faculty: "tul", lang: "cs", document: "other",
|
||||||
|
|
||||||
// document info
|
// document info
|
||||||
|
title_pages: none,
|
||||||
title: none, keywords: none, abstract: none, acknowledgement: none, author: none,
|
title: none, keywords: none, abstract: none, acknowledgement: none, author: none,
|
||||||
author_pronouns: none, supervisor: none, consultant: none, programme: none,
|
author_pronouns: none, supervisor: none, consultant: none, programme: none,
|
||||||
specialization: none, year_of_study: none,
|
specialization: none, year_of_study: none,
|
||||||
@@ -55,38 +57,30 @@
|
|||||||
// content
|
// content
|
||||||
content,
|
content,
|
||||||
) = {
|
) = {
|
||||||
import "utils.typ": assert_in_dict, assert_type_signature
|
import "arguments.typ": (
|
||||||
|
arguments,
|
||||||
|
document_info,
|
||||||
|
author_info,
|
||||||
|
project_info,
|
||||||
|
abstract_info,
|
||||||
|
check_arguments,
|
||||||
|
req_arg,
|
||||||
|
)
|
||||||
|
|
||||||
// argument checking
|
let args = arguments(
|
||||||
assert_type_signature(style, "string", "visual style argument");
|
document_info(style, faculty, lang, document),
|
||||||
assert_type_signature(faculty, "string", "faculty id argument");
|
title_pages,
|
||||||
assert_type_signature(lang, "string", "language abbreviation argument");
|
title,
|
||||||
assert_type_signature(document, "string | none", "document kind argument");
|
author_info(author, author_pronouns, programme, specialization, year_of_study),
|
||||||
assert_type_signature(title, "dictionary[string : string] | none", "title argument");
|
project_info(supervisor, consultant),
|
||||||
assert_type_signature(keywords, "dictionary[string : array[string]] | none", "keywords argument");
|
abstract_info(abstract, keywords),
|
||||||
assert_type_signature(
|
acknowledgement,
|
||||||
abstract, "dictionary[string : string | content] | none", "abstract argument"
|
assignment,
|
||||||
|
citations,
|
||||||
);
|
);
|
||||||
assert_type_signature(
|
check_arguments(args);
|
||||||
acknowledgement, "dictionary[string : string | content] | none", "acknowledgement content"
|
|
||||||
);
|
import "utils.typ": assert_in_dict, assert_type_signature
|
||||||
assert_type_signature(author, "string | none", "author argument");
|
|
||||||
assert_type_signature(author_pronouns, "string | none", "author gender argument");
|
|
||||||
assert_type_signature(
|
|
||||||
supervisor, "string | dictionary[string : string] | none", "supervisor argument"
|
|
||||||
);
|
|
||||||
assert_type_signature(
|
|
||||||
consultant, "string | dictionary[string : string] | none", "consultant argument"
|
|
||||||
);
|
|
||||||
assert_type_signature(
|
|
||||||
programme, "dictionary[string : string] | none", "study programme argument"
|
|
||||||
);
|
|
||||||
assert_type_signature(
|
|
||||||
specialization, "dictionary[string : string] | none", "study specialization argument"
|
|
||||||
);
|
|
||||||
assert_type_signature(year_of_study, "integer | none", "year of study");
|
|
||||||
assert_type_signature(assignment, "string | none", "assignment document argument");
|
|
||||||
assert_type_signature(citations, "string", "citations file argument");
|
|
||||||
|
|
||||||
// templates
|
// templates
|
||||||
import "classic/classic.typ": template_classic
|
import "classic/classic.typ": template_classic
|
||||||
@@ -101,11 +95,7 @@
|
|||||||
set text(lang: lang);
|
set text(lang: lang);
|
||||||
|
|
||||||
// template call
|
// template call
|
||||||
templates.at(style)(
|
templates.at(style)(args, content);
|
||||||
lang, faculty, document, citations, assignment,
|
|
||||||
title, author, author_pronouns, supervisor, consultant,
|
|
||||||
programme, specialization, year_of_study, abstract, acknowledgement, keywords, content
|
|
||||||
);
|
|
||||||
|
|
||||||
import "prototyping.typ": assert_release_ready
|
import "prototyping.typ": assert_release_ready
|
||||||
assert_release_ready();
|
assert_release_ready();
|
||||||
|
@@ -297,7 +297,7 @@
|
|||||||
<sort>
|
<sort>
|
||||||
<key variable="citation-number"/>
|
<key variable="citation-number"/>
|
||||||
</sort>
|
</sort>
|
||||||
<layout prefix="(" suffix=")" delimiter=", ">
|
<layout prefix="[" suffix="]" delimiter=", ">
|
||||||
<group delimiter=", ">
|
<group delimiter=", ">
|
||||||
<text variable="citation-number"/>
|
<text variable="citation-number"/>
|
||||||
<group>
|
<group>
|
||||||
@@ -312,7 +312,7 @@
|
|||||||
<key variable="citation-number"/>
|
<key variable="citation-number"/>
|
||||||
</sort>
|
</sort>
|
||||||
<layout>
|
<layout>
|
||||||
<text variable="citation-number" display="left-margin" suffix=". "/>
|
<text variable="citation-number" display="left-margin" prefix="[" suffix="] "/>
|
||||||
<choose>
|
<choose>
|
||||||
<if type="book map" match="any">
|
<if type="book map" match="any">
|
||||||
<group display="right-inline">
|
<group display="right-inline">
|
||||||
|
@@ -309,3 +309,11 @@
|
|||||||
}
|
}
|
||||||
mapper(value)
|
mapper(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#let deref(arr) = {
|
||||||
|
if arr.len() == 0 {
|
||||||
|
arr.at(0)
|
||||||
|
} else {
|
||||||
|
arr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user