allow content for many new fields

This commit is contained in:
2025-11-11 13:38:14 +01:00
parent 071696a786
commit 9c954f4f9c
4 changed files with 43 additions and 29 deletions

View File

@@ -1,9 +1,9 @@
#import "template/template.typ": *
#show: tultemplate2.with(
title: (cs: "Návod na použití Typst TUL šablony"),
author: "Ondřej Mekina, Matěj Žucha",
supervisor: "Ondřej Mekina",
title: (cs: [Návod na použití Typst TUL šablony]),
author: [Ondřej Mekina, Matěj Žucha],
supervisor: [Ondřej Mekina],
)
#profile("release")
@@ -364,6 +364,12 @@ Zde je ukázka definice příloh (je také použita na konci tohoto ukázkového
)
```
#pagebreak(weak: true)
== Argumenty šablony
#import "template/arguments.typ": print_argument_docs
#print_argument_docs()
= Workflow a jak si zjednoduššit práci
Tyhle věci používat _nemusíte_, aby vám šablona fungovala. Nicméně často jsou poměrně fajn.

View File

@@ -8,21 +8,21 @@
type: "string",
),
title_pages: "string | boolean | none",
title: "dictionary[string : string] | none",
title: "dictionary[string : string | content] | none",
author: (
name: "string | none",
name: "string | content | none",
pronouns: "string | none",
programme: "dictionary[string : string] | none",
specialization: "dictionary[string : string] | none",
year_of_study: "integer | none",
programme: "dictionary[string : string | content] | none",
specialization: "dictionary[string : string | content] | none",
year_of_study: "string | content | none",
),
project: (
supervisor: "string | dictionary[string : string] | none",
consultant: "string | dictionary[string : string] | none",
supervisor: "string | content | dictionary[string : string | content] | none",
consultant: "string | content | dictionary[string : string | content] | none",
),
abstract: (
content: "dictionary[string : string | content] | none",
keywords: "dictionary[string : array[string]] | none",
keywords: "dictionary[string : string | content | array[string]] | none",
),
acknowledgement: "dictionary[string : string | content] | none",
assignment: "dictionary[string : any] | content | string | none",
@@ -30,9 +30,9 @@
);
#let assignment_structure = (
personal_number: "string",
department: "string",
academical_year: "string",
personal_number: "string | content",
department: "string | content",
academical_year: "string | content",
content: "content",
);

View File

@@ -114,7 +114,7 @@
#let person_info(record, item_name) = {
if is_none(record) {
none
} else if type(record) == str {
} else if type(record) == str or type(record) == content {
record
} else if type(record) == dictionary {
if "name" in record {
@@ -200,7 +200,7 @@
("consultant", person_info(consultant, "consultant"), false),
("study_programme", study_programme, false),
("study_specialization", study_specialization, false),
("year_of_study", map_none(year_of_study, (v) => str(v) + "."), false),
("year_of_study", year_of_study, false),
));
}
@@ -368,6 +368,14 @@
// ABSTRACT
#let display_keywords(keywords) = {
if type(keywords) == array {
keywords.join(", ")
} else if type(keywords) == str or type(keywords) == content {
keywords
}
}
#let abstract(language, args) = {
heading(
text(req_arg(args, "title").at(language), font: base_font), numbering: none, outlined: false
@@ -385,7 +393,7 @@
linebreak();
linebreak();
text(get_lang_item(language, "keywords") + ": ", weight: "bold", font: base_font);
text(keywords.at(language).join(", "));
display_keywords(keywords.at(language))
}
}

View File

@@ -6,9 +6,9 @@
lang: "cs",
document: "bp",
assignment: (
personal_number: "A00000007",
department: "Ústav šablon",
academical_year: "2025/2026",
personal_number: [A00000007],
department: [Ústav šablon],
academical_year: [2025/2026],
content: [
= Zásady pro vypracování:
+ Seznamte se s možnostmi šablon
@@ -26,14 +26,14 @@
],
),
title: (
cs: "Ukázka dokumentu typu Bakalářská práce pro FM TUL v češtině",
en: "Example document for a Bachelor's thesis for FM TUL in Czech",
cs: [Ukázka dokumentu typu Bakalářská práce pro FM TUL v češtině],
en: [Example document for a Bachelor's thesis for FM TUL in Czech],
),
author: "Matěj Žucha",
author: [Matěj Žucha],
author_pronouns: "masculine",
programme: (cs: "MI6000000007 Přísně tajné"),
specialization: (cs: "Vytváření šablon"),
supervisor: "Ondřej Mekina",
programme: (cs: [MI6000000007 Přísně tajné]),
specialization: (cs: [Vytváření šablon]),
supervisor: [Ondřej Mekina],
abstract: (
cs: [
Tento dokument slouží jako praktická ukázka všech důležitcýh funkcí šablony _tultemplate2_,
@@ -45,10 +45,10 @@
],
),
keywords: (
cs: ("Ukázka", "Klíčových", "Slov", "Česky"),
en: ("Example", "Keywords", "In", "English"),
cs: [Ukázka, Klíčových, Slov, Česky],
en: [Example, Keywords, In, English],
),
acknowledgement: (cs: "Lorem ipsum dolor sit amet."),
acknowledgement: (cs: [Lorem ipsum dolor sit amet.]),
citations: "citations.bib",
)