Closed visika closed 5 months ago
Can you provide a minimal working example so that I can reproduce the issue please ?
This works, so I don't know why you are experiencing this issue.
#import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
// Replace the local import with a import to the preview namespace.
// If you don't know what that mean, please go read typst documentation on how to import packages at https://typst.app/docs/packages/.
#show: make-glossary
#set page(paper: "a5")
#show link: set text(fill: blue.darken(60%))
I like to eat #glspl("potato"). Yes I still like to eat #glspl("potato").
= Glossary
#print-glossary(
(
(
key: "potato",
short: "potato",
// "plural" will be used when "short" should be pluralized
plural: "potatoes",
description: [#lorem(10)],
),
),
// show all term even if they are not referenced, default to false
show-all: true,
// disable the back ref at the end of the descriptions
disable-back-references: true,
)
You are probably passing a dictionary as a parameter when the function print-glossary
expect a list of dictionaries
You are probably passing a dictionary as a parameter when the function
print-glossary
expect a list of dictionaries
Yes, that was the issue indeed. I'm not expert in Typst internals, and didn't think that the comma after a )
changed the object from a dictionary to a list. Thank you!
I hope this helps someone in the future. I know this is a edge case, as a glossary usually has more than one entry, but maybe this error can be caught and tell the user where is the problem? If it wasn't me, one would have abandoned the plugin altogether when it didn't work with one entry.
#import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
// Replace the local import with a import to the preview namespace.
// If you don't know what that mean, please go read typst documentation on how to import packages at https://typst.app/docs/packages/.
#show: make-glossary
#set page(paper: "a5")
#show link: set text(fill: blue.darken(60%))
I like to eat #glspl("potato"). Yes I still like to eat #glspl("potato").
= Glossary
#print-glossary(
(
(
key: "potato",
short: "potato",
// "plural" will be used when "short" should be pluralized
plural: "potatoes",
description: [#lorem(10)],
) // <-- Need a comma here, otherwise throws error
),
// show all term even if they are not referenced, default to false
show-all: true,
// disable the back ref at the end of the descriptions
disable-back-references: true,
)
we are working on refactoring the codebase and adding type checking but it will take some time.
I set up glossarium following the manual, and started adding my first entry. The compiler outputs this error unless I add at least two entries. I spent some minutes being confused I was doing something wrong before realizing that. Here is the output from the compiler: