parent
fd67d025ec
commit
92ca69aa56
|
|
@ -1,6 +1,5 @@
|
|||
#import "../../setup/setup.typ": gls, nogls, ravhelp
|
||||
|
||||
|
||||
= Introduction
|
||||
@fk_draan:short.
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
yaml(file).map(entry => {
|
||||
let result = (:)
|
||||
|
||||
// ----- Convert each YAML field to its Typst representation -----
|
||||
for (key, value) in entry {
|
||||
result.insert(
|
||||
key,
|
||||
|
|
@ -45,6 +46,14 @@
|
|||
)
|
||||
}
|
||||
|
||||
// ----- Fill in missing optional fields -----
|
||||
if "short" not in result {
|
||||
result.insert("short", none)
|
||||
}
|
||||
if "sort" not in result {
|
||||
result.insert("sort", result.long)
|
||||
}
|
||||
|
||||
result
|
||||
})
|
||||
}
|
||||
|
|
@ -53,6 +62,7 @@
|
|||
#let read-glossary(files) = {
|
||||
let entries = ()
|
||||
|
||||
// ----- Normalize a single file into an array -----
|
||||
if type(files) != array {
|
||||
files = (files,)
|
||||
}
|
||||
|
|
@ -60,18 +70,13 @@
|
|||
for file in files {
|
||||
let new = read-glossary-entries(file)
|
||||
|
||||
// ----- Reject duplicate glossary keys -----
|
||||
for entry in new {
|
||||
let duplicate = entries.find(e => e.key == entry.key)
|
||||
|
||||
if duplicate != none {
|
||||
panic(
|
||||
"Found duplicate key `"
|
||||
+ entry.key
|
||||
+ "` in files `"
|
||||
+ file
|
||||
+ "` and `"
|
||||
+ duplicate.file
|
||||
+ "`",
|
||||
"Found duplicate key `" + entry.key + "` in files `" + file + "`",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue