From 5e7007abd77e962666fcb274fbe2dd4d398fc249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Mekina?= Date: Tue, 23 Sep 2025 22:36:31 +0200 Subject: [PATCH] add definition to first abbreviation instance --- example.typ | 2 +- template/abbreviations.typ | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/example.typ b/example.typ index 83b8c75..590a429 100644 --- a/example.typ +++ b/example.typ @@ -1,7 +1,7 @@ #import "template/template.typ": * #show: tultemplate.with( - "classic", "fm", "en", + "classic", "fm", "cs", title: "Návod na použití Typst TUL šablony", author: "Ondřej Mekina", ) diff --git a/template/abbreviations.typ b/template/abbreviations.typ index 70c8963..96e714f 100644 --- a/template/abbreviations.typ +++ b/template/abbreviations.typ @@ -11,10 +11,18 @@ ); } abbrs.insert(abbreviation, text); + } else { + if type(text) != type(none) { + panic("redefinition of abbreviation '" + abbreviation + "'"); + } } "(" + abbrs.pairs().map((v) => { v.at(0) + ":\"" + v.at(1) + "\"" }).join(",") + ")" }); - abbreviation; + if type(text) != type(none) { + text + " (" + abbreviation + ")"; + } else { + abbreviation; + } } #let abbrlist() = {