Commit Graph
212 Commits
Author SHA1 Message Date
swaits 6d83a858c8 chore(glossy): bump copyright year in LICENSE 2025-10-26 16:00:23 -06:00
swaits bacb6cebd1 chore(glossy): add justfile, update .gitignore 2025-10-26 16:00:23 -06:00
swaits 279217dfd2 Merge pull request #55 from th1j5/main
Formalize & document glossy behaviour, simplify internals and add some features
2025-10-26 16:00:23 -06:00
swaits 8b98b9e89f refactor(glossy): Simplify the mode selection
The selection of which mode was shown was pretty complex. This is now
simplified.

First, when the mode is `auto`, the requested mode is adapted depending
on the first use counter.
Then, it is determined if the requested mode can be fulfilled or if a
fallback mode should be selected.

After this simple process, the mode is determined.
Based on #47 from BurningKarl
2025-10-26 16:00:23 -06:00
swaits 9972b93b52 feat(glossy): Add reset mode
Add the `reset` mode, in accordance with the documentation.
(updated in bffe5fdc35fcb67aca188fc0642db5bf23530bcd!)
2025-10-26 16:00:23 -06:00
swaits ae6405c288 feat(glossy): Check validity of modifiers
When an unrecognized modifier is applied, glossy should panic to warn
the user, instead of silently ignoring the modifier. This might catch
potential misspellings of modifiers.
2025-10-26 16:00:23 -06:00
swaits a6572d07ff feat(glossy): Panic on multiple requested modes
When multiple modes are requested at the same time
(like 'long' & 'short'), panic with a clear error message.

This is better than guessing what the user wanted.
2025-10-26 16:00:23 -06:00
swaits 8e3ede34dc refactor(glossy): Sanitize modes & modifiers
The list of modes & modifiers is now normalized (i.e. multiple equal
names are mapped to the same internal name, e.g. 'def' and 'desc' are
mapped to 'description').
Some sanitization is applied (not yet rigorously).

The internals are now splitted in a list of modes and a list of
modifiers.

These two actions already simplify a lot of logic (no multiple checks
for 'def' and 'desc' for example).
2025-10-26 16:00:23 -06:00
swaits c8f2c0d975 fixup! docs(glossy): Document modes vs modifiers 2025-10-26 16:00:22 -06:00
swaits a2947f2b7b feat(glossy): Count both mode as first use
A breaking change, by default the `both` mode now counts towards the
first use of a term. This in accordance to the documentation.
(updated in bffe5fdc35fcb67aca188fc0642db5bf23530bcd!)
2025-10-26 16:00:22 -06:00
swaits f745af74cc feat(glossy): Add use and nouse modifiers
Added the `:use`/`:spend` and `:nouse`/`:nospend` modifiers, in
accordance with the documentation.
(updated in bffe5fdc35fcb67aca188fc0642db5bf23530bcd!)
2025-10-26 16:00:22 -06:00
swaits 9de06d3781 feat(glossy): Decouple 'wants reference' from 'first usage'
The 'wants to be referenced from the index/glossary' counter is now
decoupled from the '(first) usage' counter. This is made consistent with
the documentation (updated in bffe5fdc35fcb67aca188fc0642db5bf23530bcd!).

Furthermore, when the 'supplement' mode is used, the term is now NOT
counted as (first) used (by default). This is now consistent with the
documentation.
2025-10-26 16:00:22 -06:00
swaits 4f26f9a194 docs(glossy): Add and modify first-use behaviour
Add a mode, two modifiers and change the default usage behaviour of some
modes. This documents the glossy 'API' when using terms with respect to
the usage counter.

Important!
At the moment, this is a description of the intended endresult
(documentation driven development). Next commits will bring the code in
accordance with this desired result.
2025-10-26 16:00:22 -06:00
swaits 2e9b81dff4 docs(glossy): Document modes vs modifiers
This distinction between 'mode' vs 'modifier' is already a bit visible
when looking at which modifiers can be combined and what output they
produce. This is just formalizing and categorizing that behaviour.

Also create a comprehensive reference table for all modes and modifiers.

This distinction is made in preparation for more modes & modifiers to
control the usage counter, while keeping everything understandable.
2025-10-26 16:00:22 -06:00
swaits 3b7a1404ea docs(glossy): Add format-term documentation 2025-10-26 16:00:22 -06:00
swaits b250c35f78 docs(glossy): Add Changelog to README 2025-10-26 16:00:22 -06:00
swaits 552858d813 Merge pull request #49 from chardetm/patch-1
Fixed term-links documentation in README.md
2025-10-26 16:00:21 -06:00
swaits 03e8e62c70 feat(glossy): Return array of pages in theme
Instead of returning an opaque context element with a fixed list of the
pages, return an array of context elements with each a page
(already unique!).
This is conceptually cleaner. Now it's the themes responsability to join
the array of unique pages however it wants. Most times, this will be a
`.join(", ")`, but could be e.g. `.first()` if the theme only wants to
show the page of the first occurance of this term.
Also update the documentation.

Breaking API change in the themes.
No visual differences (tests remain the same), but there are binary
differences.
2025-10-26 16:00:21 -06:00
swaits f7727f5abd Merge pull request #58 from jounathaen/patch-1
Corrected term-links word twister in README
2025-10-26 16:00:21 -06:00
Maverick Chardet f3cc41360c Fixed term-links documentation in README.md
The `term-links` parameter was listed as `link-terms` in the README file. This commit fixes it.
2025-10-26 16:00:21 -06:00
swaits 68945132fb feat(glossy): Remove hide/hidden modifier
This modifier was not orthogonal with other modifiers (for example, it
could not be used together with :noindex)
Added documentation and modified test to reflect that @term[] with an
empty supplement has exactly the same result *and* is more orthogonal.

This partially reverts commit 5957432d5d.
2025-10-26 16:00:21 -06:00
swaits 93af7fa6b4 Merge pull request #50 from BurningKarl/fix-glossary-links
glossy: generate correct links to glossary entry
2025-10-26 16:00:21 -06:00
Jonathan 0bd35b1984 Corrected term-links word twister in README
Fixes #57
2025-10-26 16:00:21 -06:00
swaits 392e8a8122 fix(glossy): Ensure ∅ supplement results in ∅ content
Ensure an empty supplement results in glossy returning empty content,
instead of an empty string. Done by returning #none if no article is
wanted.

When the value #none is returned for the article, this can neatly join
with the other values without a trace. In particular, when `term` is
empty content, this ensures that only #metadata remains, exactly like
in the 'hidden' case.

Effectively, now @term[] is identical to @term:hidden, because no empty
string is inserted. This can be seen in the updated test case, where the
spaces around the blank term are now collapsed to a single space by
Typst, instead of keeping two spaces like before.

A next commit will remove :hidden, since it's not orthogonal w.r.t.
other modifiers, while using a supplement is.
2025-10-26 16:00:21 -06:00
mewmew b8af7ab776 glossy: fix minor typo in readme 2025-10-26 16:00:21 -06:00
BurningKarl ca57b15ccf fix(glossy): generate correct links to glossary entry 2025-10-26 16:00:21 -06:00
swaits 3e0d7a9812 chore(glossy): Improve code readability
The new function was already present, but unused.
2025-10-26 16:00:21 -06:00
swaits 45112b434f chore(glossy): bump version to 0.8.0 2025-10-26 16:00:20 -06:00
swaits 8a2a2956bc chore: fix path in sync.sh script 2025-10-26 16:00:20 -06:00
swaits 68addf1204 Merge pull request #46 from BurningKarl/reduce-layout-attempts
Fix glossy: avoid duplicate key labels
2025-04-03 15:16:09 -07:00
BurningKarl 797fc68857 fix(glossy): avoid duplicate key labels 2025-04-03 15:16:09 -07:00
swaits 8e8723b8d1 docs(glossy): update README with newest features 2025-04-03 15:06:46 -07:00
swaits 666f26586e Merge pull request #43 from playonverbs/feature/glossy/show-all
Add show-all flag to glossary() and test-case
2025-04-03 14:49:32 -07:00
Niam Patel b899c875c9 Add show-all flag to glossary() and test-case 2025-04-03 08:46:11 -07:00
swaits 3264971bfe Merge pull request #44 from kaerbr/main
docs: fix setting of custom theme in glossary function
2025-04-03 08:39:37 -07:00
Kilian eb382d36cf docs: fix setting of custom theme in glossary function 2025-04-03 08:37:28 -07:00
swaits 4fc05c37a2 feat(glossy): use @term[supplement] to override term display
If you want to completely override how a term is displayed, you can pass
content in via the square brackets on the term's reference.

For example, a term @www which might normally display as "worldwide web
(WWW)" or something similar, could instead display as FOOBAR by using
@www[FOOBAR].
2025-04-03 08:37:28 -07:00
swaits 5957432d5d feat(glossy): adds hide/hidden modifier to suppress term display
There are cases where you might want a term referenced (ie from the
Glossary/Index), but don't want to display it. New modifiers
`hide`||`hidden` do exactly that.
2025-04-03 08:37:28 -07:00
swaits 966a89687a test(glossy): update all tests for Typst 0.13.0 2025-04-03 08:37:28 -07:00
swaits 2b8095d098 fix(glossy): default term-links to false
This parameter (to init-glossary()) enables/disables the terms in the
document linking to their place in the glossary. However, this adds a
crazy amount of extra queries which sometimes hinders Typst's ability to
converge on documents.
2025-04-03 08:37:28 -07:00
swaits c0077ca432 docs(glossy): fix theme parameter typos in README 2025-04-03 08:37:27 -07:00
swaits bc21afc193 chore: merge commit to consolidate upstream merges 2025-04-03 08:17:16 -07:00
swaits 193137fe9b test(codly-languages): update tests for next version codly-languages-0.1.8 2025-03-04 14:46:32 -08:00
swaits f044759876 Merge pull request #41 from Akito3110/codly-languages-0.1.8
codly-languages: normalized and added lots of icons
2025-03-04 10:21:39 -08:00
Akito ba13ac047e changed version to 0.1.8 2025-03-04 10:19:54 -08:00
Akito 431d065e59 adjusted README 2025-03-04 10:19:54 -08:00
Akito 7373005ef2 added view with all icons to test 2025-03-04 10:19:54 -08:00
Akito 006f630e10 normalized and added lots of icons 2025-03-04 10:19:54 -08:00
swaits 1f5e01c136 chore: merge commit to consolidate upstream merges 2025-03-04 10:18:25 -08:00
swaits 7117a1e60f chore(glossy): update minimum compiler version to 0.13.0 glossy-0.7.0 2025-02-19 15:48:45 -07:00