Compare commits
2 Commits
9657f4b75b
...
1f75a74f61
Author | SHA1 | Date | |
---|---|---|---|
1f75a74f61
|
|||
5d17fa8fe3
|
11
example.typ
11
example.typ
@@ -2,17 +2,6 @@
|
||||
|
||||
#show: tultemplate2.with(
|
||||
title_cs: "Návod na použití Typst TUL šablony",
|
||||
abstract_cs: [
|
||||
V tomto dokumentu se naučíte základy použití TUL Typst šablony a i nějaké lehké základy Typstu.
|
||||
Šablonu vyvíjíme pro *všechny fakulty* TUL a snažíme se postupně přidávat všechny typy
|
||||
vysokoškolských prací.
|
||||
|
||||
Tento dokument by měl být vhodný pro všechny čtenáře
|
||||
(ze všech fakult a s různými úrovněmi dovedností). Pokud je něco popsáno nejasně
|
||||
(nebo něco chybí), prosíme, dejte nám vědět. Snažíme se šablonu i dokumentaci průběžně
|
||||
zlepšovat.
|
||||
],
|
||||
keywords_cs: ("šablona", "TUL", "Typst"),
|
||||
author: "Ondřej Mekina, Matěj Žucha",
|
||||
supervisor: "Ondřej Mekina",
|
||||
)
|
||||
|
@@ -16,7 +16,9 @@
|
||||
"date": "[day]. [month]. [year]",
|
||||
|
||||
"abstract": "Abstrakt",
|
||||
"keywords": "Klíčová slova"
|
||||
"keywords": "Klíčová slova",
|
||||
|
||||
"place_assignment": "Sem vložte zadání"
|
||||
},
|
||||
|
||||
"en": {
|
||||
@@ -36,6 +38,8 @@
|
||||
"date": "[year]-[month]-[day]",
|
||||
|
||||
"abstract": "Abstract",
|
||||
"keywords": "Keywords"
|
||||
"keywords": "Keywords",
|
||||
|
||||
"place_assignment": "Insert your assignment here"
|
||||
}
|
||||
}
|
||||
|
@@ -23,10 +23,16 @@
|
||||
// - faculty (str): Factulty abbreviation. One of "fs", "ft", "fp", "ef", "fua", "fm", "fzs", "cxi".
|
||||
// - lang (str): Language code. This can be "cs" or "en".
|
||||
// - document (str): Type of document. This can be "bp", "dp", "ds".
|
||||
// - title (str): The title of the document.
|
||||
// - title_cs (str): The title (Czech) of the document.
|
||||
// - author (str): The name of the document's author.
|
||||
// - supervisor (str): The name of the document's supervisor.
|
||||
// - programme (str): Study programme.
|
||||
// - abstract_cs (content): The abstract (Czech).
|
||||
// - keywords_cs (array): The abstract keywords (Czech).
|
||||
// - title_en (str): The title (English) of the document.
|
||||
// - abstract_en (content): The abstract (English).
|
||||
// - keywords_en (array): The abstract keywords (English).
|
||||
// - assignment (str): Filepath of the assignment document/page.
|
||||
// - citations (str): The location of the citation file.
|
||||
// - content (content): The content of the document
|
||||
//
|
||||
@@ -39,6 +45,7 @@
|
||||
title_cs: none, author: none, supervisor: none, programme: none, abstract_cs: none,
|
||||
keywords_cs: none,
|
||||
title_en: none, abstract_en: none, keywords_en: none,
|
||||
assignment: none,
|
||||
citations: "citations.bib",
|
||||
content,
|
||||
) = {
|
||||
@@ -53,10 +60,18 @@
|
||||
import "lang.typ": lang_ids
|
||||
assert_in_dict(lang, lang_ids, "language abbreviation");
|
||||
set text(lang: lang);
|
||||
|
||||
// verify
|
||||
if document == "bp" and (type(abstract_cs) == type(none) or type(abstract_en) == type(none)) {
|
||||
panic("need both czech and english abstract for document of type 'bp'");
|
||||
}
|
||||
|
||||
// template call
|
||||
templates.at(style)(
|
||||
faculty, lang, document,
|
||||
title_cs, author, supervisor, programme, abstract_cs, keywords_cs,
|
||||
title_en, abstract_en, keywords_en,
|
||||
if type(assignment) == type(none) { none } else { "../" + assignment },
|
||||
"../" + citations,
|
||||
content
|
||||
);
|
||||
|
@@ -27,7 +27,8 @@
|
||||
|
||||
// document type
|
||||
if type(document_type) != type(none) {
|
||||
let document_types = ("bp", "dp", "dis", "hab", "teze", "autoref", "proj", "sp");
|
||||
// TODO: hab, teze, autoref, proj, sp
|
||||
let document_types = ("bp", "dp", "dis");
|
||||
assert_in_arr(document_type, document_types, "document type abbreviation");
|
||||
text(get_lang_item(language, document_type), weight: "bold", font: base_font);
|
||||
v(0em);
|
||||
@@ -100,6 +101,25 @@
|
||||
}, margin: 2cm);
|
||||
}
|
||||
|
||||
#let assignment(language, document) = {
|
||||
if type(document) == type(none) {
|
||||
page(
|
||||
place(center + horizon, text(
|
||||
get_lang_item(language, "place_assignment"),
|
||||
fill: red,
|
||||
size: 3em,
|
||||
font: base_font,
|
||||
weight: "bold",
|
||||
)),
|
||||
footer: none,
|
||||
);
|
||||
return;
|
||||
}
|
||||
import "@preview/muchpdf:0.1.1": muchpdf
|
||||
set page(margin: 0em);
|
||||
muchpdf(read(document, encoding: none));
|
||||
}
|
||||
|
||||
#let disclaimer(language, faculty_id, disclaimer_type, author) = {
|
||||
let disclaimers_for = ("bp");
|
||||
if type(disclaimer_type) == type(none) or disclaimer_type not in disclaimers_for {
|
||||
@@ -170,6 +190,7 @@
|
||||
document_type,
|
||||
title_cs, author, supervisor, study_programme, abstract_cs, keywords_cs,
|
||||
title_en, abstract_en, keywords_en,
|
||||
assignment_document,
|
||||
citation_file,
|
||||
content,
|
||||
) = {
|
||||
@@ -228,6 +249,11 @@
|
||||
set highlight(fill: faculty_color.lighten(90%));
|
||||
set image(width: 80%);
|
||||
|
||||
// assignment
|
||||
if document_type in ("bp", "dp", "dis") or type(assignment_document) != type(none) {
|
||||
assignment(language, assignment_document);
|
||||
}
|
||||
|
||||
// disclaimer
|
||||
disclaimer(language, faculty_id, document_type, author);
|
||||
|
||||
|
Reference in New Issue
Block a user