Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A warning when a defined term is used without being marked up as a defined term. #69

Open
gerob311 opened this issue Oct 23, 2024 · 3 comments
Assignees

Comments

@gerob311
Copy link

For example, something like:

#let entry-list = (
  (
      key: "computer",
      short: "computer",
      plural: "computers",
      description: [An @electronic device for performing computations.]
  )
)
#register-glossary(entry-list)

Computers are useful for things.

#print-glossary(entry-list, warn-on-nondefined-term: true)

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:

#ndt("Computers") are useful for things.

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.

@quachpas quachpas self-assigned this Oct 24, 2024
@quachpas
Copy link
Collaborator

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.

@gerob311
Copy link
Author

gerob311 commented Nov 4, 2024

@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.

@quachpas
Copy link
Collaborator

quachpas commented Nov 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants