Closes [#24](https://github.com/swaits/typst-collection/issues/24)
- Fixed academic theme (no longer hardcodes a font)
- New modifiers: noref/noindex - keeps terms out of glossary
- New behavior: short/long/both no longer count against "first use"
New feature:
`init-glossary()` now accepts a `format-term()` function which gives the
user control over how the short-form and long-form of the terms are
assembled based on the needed mode ("short", "long", or "both").
Change:
Default theme changed to `theme-academic`, which is probably more
generally useful than the prior (`theme-twocol`).
Idea [from Discord
conversation](https://discord.com/channels/1054443721975922748/1318670789150642246/1319338465757757562).
Let's users more precisely control how short-form and long-form terms
are used based on the mode ("short", "long", or "both").
Defaults to `__default-format-term()` as below:
```typst
// Formats a term string based on the specified mode.
//
// Given mode, long-form, and short-form, this function returns the formatted
// term based on the mode. When mode is ...
//
// - "short" -> returns "short-form"
// - "long" -> returns "long-form"
// - "both" -> returns "short-form (long-form)"
//
// Parameters:
// mode (string): The mode in which to format the term. Possible values are "short", "long", or "both".
// short-form (string): The short form of the term.
// long-form (string): The long form of the term.
//
// Returns:
// string: The formatted term based on the specified mode.
//
#let __default-format-term(mode, short-form, long-form) = {
if mode == "short" {
short-form
} else if mode == "long" {
long-form
} else {
// mode assumed to be "both"
long-form + " (" + short-form + ")"
}
}
```
- Merges [16](https://github.com/swaits/typst-collection/pull/16).
- Fixes [3](https://github.com/swaits/typst-collection/issues/3).
A big PR from [@eltos](https://github.com/eltos)!
This adds labels for each `key`, so that auto-complete (in the typst.app
/ `typst-ide`) works properly. It also makes it so terms can link to
their glossary entry. In the case that terms are used but no glossary is
shown (which is a core feature of Glossy), placeholder labels are used
so that the auto-complete still works.
All tests, but one (theme-gallery), passed straight from the PR. The
ddiff in the `theme-gallery` test were non-visible (ie a few pixels),
making it effectively passing too. Updated that test so it passes, and
updated the theme screenshot to match its output as well.
Huge thanks to [@eltos](https://github.com/eltos) who demonstrates a
deep understanding of Typst!
- Uniqfies the duplicate term usage tracking via counter + state to just using the counter. Refreactor the code with the two methods "mark_term_used" and "is_term_used".
- Adds a label with the entry key for autocompletion
- either in the glossary (if it is visible and there is a corresponding entry)
- or invisible during init-glossary
- Use a single label for all usages of the entry in the text. This simplifies the back-referencing logic significantly and also avoids cluttering the auto-complete list
closes https://github.com/swaits/typst-collection/issues/3
## New features:
**Articles with `a`/`an` modifier**
Now you can include articles using this new modifier. The articles may
be defined in your dictionary entry (fields `artcile`, and
`longarticle`). But, if you don't define them, Glossy will do a
reasonably good job at guessing them.
This modifier is also allowed before the term. For example, you might
have this term:
```yaml
www: Worldwide Web
```
And you could display it with an article by any of these:
```typst
@a:www
@an:www
@www:a
@www:an
```
These, `a` and `an` are exactly equivalent. They're just provided for
your convenience. Use either or both.
The `a`/`an` modifier works with all modifiers except `pl` and
`def`/`desc`.
If you want to define custom articles for your terms, do so like this:
```typst
#let glossary = (
rf: (
short: "RF",
article: "an",
long: "radio frequency",
longarticle: "a",
)
uts: (
short: "UTS",
article: "a",
long: "untranslatable string",
longarticle: "an",
)
)
```
But again, in most cases (for English) you shouldn't need to because
Glossy should usually get it right.
Fixes [#12](https://github.com/swaits/typst-collection/issues/12).
## Other changes:
- added test which exhausts all reference options
- added panic if 'def'/'desc' used when no `description` field exists
- significantly improved the (English) pluralizer function
- `__gls()` function refactored, cleaned up
- removed a rogue PDF
## Contributors:
- [@eltos](https://github.com/eltos)
- [@theRealProHacker](https://github.com/theRealProHacker)
Breaking changes:
- change input to dictionary of dictionaries instead of array of dictionaries
New features:
- add @term:def/@term:desc to display description
- add two new themes, theme-basic and theme-compact
Chores, fixes:
- copy 0.1.2 over to 0.2.0
- bump versions to 0.2.0 in all code/docs
- make __pluralize handle 'none' input
- document and refactor code
- update README.md
- rename theme-2col -> theme-twocol