diff --git a/glossy/src/gloss.typ b/glossy/src/gloss.typ index e570566..dce47c2 100644 --- a/glossy/src/gloss.typ +++ b/glossy/src/gloss.typ @@ -239,7 +239,10 @@ // --------------------------------------------------------------------------- let is_first_use = not __is_term_first_used(key, location: here()) let count-as-first-use = ("short" not in modifiers and "long" not in modifiers and "both" not in modifiers) - __mark_term_used(key, count-as-first-use) + let wants_reference = ("noref" not in modifiers and "noindex" not in modifiers) + if wants_reference { + __mark_term_used(key, count-as-first-use) + } // --------------------------------------------------------------------------- // Helper Functions @@ -364,15 +367,20 @@ } else { term } - [#article#show-term(linked-term)#metadata(term)#__term_label(key)] - // |^^^^^^^|^^^^^^^^^ |^^^^^^^^ |^^^^^^^^^^^^ - // \_art. | | | + let term-label = if wants_reference { + __term_label(key) + } else { + [] + } + [#article#show-term(linked-term)#metadata(term)#term-label] + // |^^^^^^^|^^^^^^^^^ |^^^^^^^^ |^^^^^^^^^^^^ + // \_art. | | | // \_ apply user formatting function to the term - // | | - // \_ metadata lets us label (ie it's "labelable") - // | - // \_ i.e. <__gloss:key>, etc. - // for backlink from glossary + // | | + // \_ metadata lets us label (ie makes it "labelable") + // | + // \_ i.e. <__gloss:key>, etc. + // for backlink from glossary } } diff --git a/glossy/tests/noref/ref/1.png b/glossy/tests/noref/ref/1.png new file mode 100644 index 0000000..4aad2c9 Binary files /dev/null and b/glossy/tests/noref/ref/1.png differ diff --git a/glossy/tests/noref/test.typ b/glossy/tests/noref/test.typ new file mode 100644 index 0000000..ba62835 --- /dev/null +++ b/glossy/tests/noref/test.typ @@ -0,0 +1,26 @@ +#import "/lib.typ": * + +// Our test glossary +#show: init-glossary.with(( + Normal: "this is a normal term", + NoRef: "this term is noref'd", + NoIndex: "this term is noindex'd", + NoRefNoIndex: "this term is noref'd and noindex'd", +)) + +// Configure styling + +#set page(margin: 1em) +#set page(width: 3.5in) +#set page(height: auto) +#set text(size: 10pt) + +@Normal + +@NoRef:noref + +@NoIndex:noindex + +@NoRefNoIndex:noref:noindex + +#glossary()