Open gerob311 opened 1 month ago
Hello @gerob311, I am unsure about what exactly you are asking. If I understand well, you would like warnings to be raised if a term that exists in the glossary is used without referencing it, is that correct? Unfortunately, warnings are not implemented yet in Typst, so the package cannot do that.
@quachpas, yes, that's the idea. It comes from something a previous employer did, where we used ConTeXt, and rolled our own glossary. We had a Ruby script which examined a document, looked up terms in our master glossary document, and created a glossary from terms that were marked up as defined terms (and raised an error if the term wasn't in the master glossary). Such a script isn't necessary with Glossarium, but it did also warn us when we used terms that hadn't been marked up. I thought that if it was possible, it would be nice if everything just happened in the Typst compiler, rather than needing another script.
I wonder if this would be possible with a plugin, rather than just a template. Or perhaps later down the track as Typst evolves.
Thanks! ATM, I don't think it's possible within the same compilation process without raising panic (not warnings). What I do recommend is examining your document by glossary key, which are usually stem, e.g., "computer" for "Computers". A simple ripgrep through the code should give you all instances of usage. Something like
rg '(^|[^@])key'
where key is the word you are looking for
For example, something like:
A warning should be raised in the logs about a term being used that was not marked up as a defined term. This warning could be removed as follows:
Where
ndt
is short for "non-defined term", and means that the author is explicitly stating that in this instance, the definition in the glossary is not meant by the usage of the word.This would of course mean that a collection of all forms of a term (long, short, plural, longplural) would need to be maintained so that they can be looked up, rather than just looking up by key.