add function documentation and citation file changing

This commit is contained in:
2025-09-24 13:37:44 +02:00
parent a446bce8e6
commit 3d183b8673
4 changed files with 83 additions and 27 deletions

View File

@@ -8,28 +8,53 @@
#import "prototyping.typ": todo, profile
#let tultemplate(
template_id,
faculty_abbreviation,
language,
document_type: none,
title: none, author: none, supervisor: none, study_programme: none,
// TUL Template 2
//
// Use this at the beginning of a Typst file:
// ```typst
// #import "template/template.typ": *
//
// #show: tultemplate2.with(
// "classic", "fm", "cs", ...
// )
// ```
//
// - style (str): Visual style to use. This can be "latex".
// - 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.
// - author (str): The name of the document's author.
// - supervisor (str): The name of the document's supervisor.
// - programme (str): Study programme.
// - citations (str): The location of the citation file.
// - content (content): The content of the document
//
//-> none
#let tultemplate2(
style,
faculty,
lang,
document: none,
title: none, author: none, supervisor: none, programme: none,
citations: "citations.bib",
content,
) = {
import "template_classic.typ": template_classic
import "utils.typ": assert_in_dict
let templates = (
classic: template_classic,
latex: template_classic,
);
assert_in_dict(template_id, templates, "template name");
assert_in_dict(style, templates, "template name");
// global set-up
import "lang.typ": lang_ids
assert_in_dict(language, lang_ids, "language abbreviation");
set text(lang: language);
templates.at(template_id)(
faculty_abbreviation, language, document_type,
title, author, supervisor, study_programme,
assert_in_dict(lang, lang_ids, "language abbreviation");
set text(lang: lang);
templates.at(style)(
faculty, lang, document,
title, author, supervisor, programme,
"../" + citations,
content
);
@@ -37,6 +62,10 @@
assert_release_ready();
}
// Make a new abbreviation
//
// - abbreviation (str): The abbreviation
// - text (str): Optionally, the text - the meaning of the abbreviation.
#let abbr(abbreviation, ..text) = {
import "abbreviations.typ": abbr
return abbr(abbreviation, if text.pos().len() == 0 { none } else { text.pos().at(0) });