add assignment page
This commit is contained in:
11
example.typ
11
example.typ
@@ -2,17 +2,6 @@
|
|||||||
|
|
||||||
#show: tultemplate2.with(
|
#show: tultemplate2.with(
|
||||||
title_cs: "Návod na použití Typst TUL šablony",
|
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",
|
author: "Ondřej Mekina, Matěj Žucha",
|
||||||
supervisor: "Ondřej Mekina",
|
supervisor: "Ondřej Mekina",
|
||||||
)
|
)
|
||||||
|
@@ -16,7 +16,9 @@
|
|||||||
"date": "[day]. [month]. [year]",
|
"date": "[day]. [month]. [year]",
|
||||||
|
|
||||||
"abstract": "Abstrakt",
|
"abstract": "Abstrakt",
|
||||||
"keywords": "Klíčová slova"
|
"keywords": "Klíčová slova",
|
||||||
|
|
||||||
|
"place_assignment": "Sem vložte zadání"
|
||||||
},
|
},
|
||||||
|
|
||||||
"en": {
|
"en": {
|
||||||
@@ -36,6 +38,8 @@
|
|||||||
"date": "[year]-[month]-[day]",
|
"date": "[year]-[month]-[day]",
|
||||||
|
|
||||||
"abstract": "Abstract",
|
"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".
|
// - 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", "dp", "ds".
|
// - 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.
|
// - author (str): The name of the document's author.
|
||||||
// - supervisor (str): The name of the document's supervisor.
|
// - supervisor (str): The name of the document's supervisor.
|
||||||
// - programme (str): Study programme.
|
// - 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.
|
// - citations (str): The location of the citation file.
|
||||||
// - content (content): The content of the document
|
// - content (content): The content of the document
|
||||||
//
|
//
|
||||||
@@ -39,6 +45,7 @@
|
|||||||
title_cs: none, author: none, supervisor: none, programme: none, abstract_cs: none,
|
title_cs: none, author: none, supervisor: none, programme: none, abstract_cs: none,
|
||||||
keywords_cs: none,
|
keywords_cs: none,
|
||||||
title_en: none, abstract_en: none, keywords_en: none,
|
title_en: none, abstract_en: none, keywords_en: none,
|
||||||
|
assignment: none,
|
||||||
citations: "citations.bib",
|
citations: "citations.bib",
|
||||||
content,
|
content,
|
||||||
) = {
|
) = {
|
||||||
@@ -53,10 +60,18 @@
|
|||||||
import "lang.typ": lang_ids
|
import "lang.typ": lang_ids
|
||||||
assert_in_dict(lang, lang_ids, "language abbreviation");
|
assert_in_dict(lang, lang_ids, "language abbreviation");
|
||||||
set text(lang: lang);
|
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)(
|
templates.at(style)(
|
||||||
faculty, lang, document,
|
faculty, lang, document,
|
||||||
title_cs, author, supervisor, programme, abstract_cs, keywords_cs,
|
title_cs, author, supervisor, programme, abstract_cs, keywords_cs,
|
||||||
title_en, abstract_en, keywords_en,
|
title_en, abstract_en, keywords_en,
|
||||||
|
if type(assignment) == type(none) { none } else { "../" + assignment },
|
||||||
"../" + citations,
|
"../" + citations,
|
||||||
content
|
content
|
||||||
);
|
);
|
||||||
|
@@ -100,6 +100,25 @@
|
|||||||
}, margin: 2cm);
|
}, 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 disclaimer(language, faculty_id, disclaimer_type, author) = {
|
||||||
let disclaimers_for = ("bp");
|
let disclaimers_for = ("bp");
|
||||||
if type(disclaimer_type) == type(none) or disclaimer_type not in disclaimers_for {
|
if type(disclaimer_type) == type(none) or disclaimer_type not in disclaimers_for {
|
||||||
@@ -170,6 +189,7 @@
|
|||||||
document_type,
|
document_type,
|
||||||
title_cs, author, supervisor, study_programme, abstract_cs, keywords_cs,
|
title_cs, author, supervisor, study_programme, abstract_cs, keywords_cs,
|
||||||
title_en, abstract_en, keywords_en,
|
title_en, abstract_en, keywords_en,
|
||||||
|
assignment_document,
|
||||||
citation_file,
|
citation_file,
|
||||||
content,
|
content,
|
||||||
) = {
|
) = {
|
||||||
@@ -228,6 +248,11 @@
|
|||||||
set highlight(fill: faculty_color.lighten(90%));
|
set highlight(fill: faculty_color.lighten(90%));
|
||||||
set image(width: 80%);
|
set image(width: 80%);
|
||||||
|
|
||||||
|
// assignment
|
||||||
|
if document_type in ("bp", "dp", "dis") or type(assignment_document) != type(none) {
|
||||||
|
assignment(language, assignment_document);
|
||||||
|
}
|
||||||
|
|
||||||
// disclaimer
|
// disclaimer
|
||||||
disclaimer(language, faculty_id, document_type, author);
|
disclaimer(language, faculty_id, document_type, author);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user