Allow concise entry definition

closes #13
This commit is contained in:
Philipp Niedermayer committed 2024-12-15 19:32:27 +00:00
1 parent f4b7cc1374
commit 91de1816e9
2 files changed
+9 -3

No files matched your search

+4 -1
View File
@@ -69,7 +69,8 @@ Use the `init-glossary` function to initialize glossary entries:
// Optional: Override automatic pluralization
plural: "TPSes",
longplural: "test procedure specifications"
)
),
WWW: "World Wide Web", // concise entry with only short: long
)
#show: init-glossary.with(myGlossary)
@@ -107,6 +108,8 @@ tps:
description: A formal document describing test steps and expected results
plural: TPSes
longplural: test procedure specifications
WWW: World Wide Web
```
And then loaded during initialization as follows:
+5 -2
View File
@@ -21,7 +21,10 @@
// - If 'short' value is not a string
// - If 'short' value is an empty string
//
#let __normalize_entry(entry) = {
#let __normalize_entry(key, entry) = {
if (type(entry) == str){
entry = (short: key, long: entry)
}
// Validate required fields
if not "short" in entry {
panic("Entry must contain a 'short' key")
@@ -329,7 +332,7 @@
// Process and store each glossary entry
for (key, entry) in entries {
__add_entry(key, __normalize_entry(entry))
__add_entry(key, __normalize_entry(key, entry))
}
// Set up reference handling for glossary terms