From f745af74cc27d168cc7504c733df3d270ccb0025 Mon Sep 17 00:00:00 2001 From: Thijs Paelman Date: Mon, 26 May 2025 21:38:51 +0200 Subject: [PATCH] feat(glossy): Add use and nouse modifiers Added the `:use`/`:spend` and `:nouse`/`:nospend` modifiers, in accordance with the documentation. (updated in bffe5fdc35fcb67aca188fc0642db5bf23530bcd!) --- glossy/src/gloss.typ | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glossy/src/gloss.typ b/glossy/src/gloss.typ index 22e16ec..8c1b7df 100644 --- a/glossy/src/gloss.typ +++ b/glossy/src/gloss.typ @@ -234,6 +234,9 @@ if ("a" in modifiers or "an" in modifiers) and ("pl" in modifiers) { panic("Cannot use 'a'/'an' and 'pl' together.") } + if ("use" in modifiers or "spend" in modifiers) and ("nouse" in modifiers or "nospend" in modifiers) { + panic("Cannot use 'use'/'spend' and 'nouse'/'nospend' together.") + } // --------------------------------------------------------------------------- // Retrieve the glossary entry and its label @@ -258,8 +261,11 @@ and "long" not in modifiers // mode is not long and "both" not in modifiers // mode is not both and (display-text == none or display-text == auto)) // mode is not supplement + let force-count-as-first-use = ("use" in modifiers or "spend" in modifiers) + let force-skip-as-first-use = ("nouse" in modifiers or "nospend" in modifiers) let wants_reference = ("noref" not in modifiers and "noindex" not in modifiers) - __mark_term_used(key, wants_reference, default-count-as-first-use) + __mark_term_used(key, wants_reference, force-count-as-first-use + or (not force-skip-as-first-use and default-count-as-first-use)) // --------------------------------------------------------------------------- // Helper Functions