From dfb2cdbebe045466c31a677d9467e4f7a9dccfea Mon Sep 17 00:00:00 2001 From: Sven Vogel Date: Mon, 8 Jul 2024 14:50:07 +0200 Subject: [PATCH] added: auto grouping for glossary --- src/glossary.typ | 16 +++++++++++++++- template/glossary.yml | 4 +--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/glossary.typ b/src/glossary.typ index 0439a5c..2173a67 100644 --- a/src/glossary.typ +++ b/src/glossary.typ @@ -46,7 +46,21 @@ type(v.group) == str, message: "The optional group of glossary entry `" + k + "` is not a string") } else { - panic("Missing group for glossary entry: `" + k + "`") + let group = if "long" in v { + if (context text.lang) == "de" { + "Akronym" + } else { + "Acronym" + } + } else { + if (context text.lang) == "de" { + "Begriff" + } else { + "Term" + } + } + + entries.at(k).group = group } } diff --git a/template/glossary.yml b/template/glossary.yml index 83548c7..c45422f 100644 --- a/template/glossary.yml +++ b/template/glossary.yml @@ -3,9 +3,7 @@ oidc: short: OIDC long: OpenID Connect desc: "OpenID is an open standard and decentralized authentication protocol promoted by the non-profit #link(\"https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation\")[OpenID Foundation]." - group: Acronym potato: short: potato - desc: "#lorem(50)" - group: Acronym \ No newline at end of file + desc: "#lorem(50)" \ No newline at end of file