diff --git a/example.typ b/example.typ index 9eaabff..28d7a86 100644 --- a/example.typ +++ b/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", ) diff --git a/template/lang.json b/template/lang.json index 15ad2dd..1b2b951 100644 --- a/template/lang.json +++ b/template/lang.json @@ -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" } } diff --git a/template/template.typ b/template/template.typ index 41339b4..b887400 100644 --- a/template/template.typ +++ b/template/template.typ @@ -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 ); diff --git a/template/template_classic.typ b/template/template_classic.typ index 06d02bf..ee667c0 100644 --- a/template/template_classic.typ +++ b/template/template_classic.typ @@ -100,6 +100,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 +189,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 +248,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);