feat(glossy): adds noref|noindex modifier
Per suggestion in [#24](https://github.com/swaits/typst-collection/issues/24)
This commit is contained in:
3 files changed
+43
-9
No files matched your search
+17
-9
@@ -239,7 +239,10 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
let is_first_use = not __is_term_first_used(key, location: here())
|
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)
|
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
|
// Helper Functions
|
||||||
@@ -364,15 +367,20 @@
|
|||||||
} else {
|
} else {
|
||||||
term
|
term
|
||||||
}
|
}
|
||||||
[#article#show-term(linked-term)#metadata(term)#__term_label(key)]
|
let term-label = if wants_reference {
|
||||||
// |^^^^^^^|^^^^^^^^^ |^^^^^^^^ |^^^^^^^^^^^^
|
__term_label(key)
|
||||||
// \_art. | | |
|
} else {
|
||||||
|
[]
|
||||||
|
}
|
||||||
|
[#article#show-term(linked-term)#metadata(term)#term-label]
|
||||||
|
// |^^^^^^^|^^^^^^^^^ |^^^^^^^^ |^^^^^^^^^^^^
|
||||||
|
// \_art. | | |
|
||||||
// \_ apply user formatting function to the term
|
// \_ apply user formatting function to the term
|
||||||
// | |
|
// | |
|
||||||
// \_ metadata lets us label (ie it's "labelable")
|
// \_ metadata lets us label (ie makes it "labelable")
|
||||||
// |
|
// |
|
||||||
// \_ i.e. <__gloss:key>, etc.
|
// \_ i.e. <__gloss:key>, etc.
|
||||||
// for backlink from glossary
|
// for backlink from glossary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -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()
|
||||||
Reference in new issue
Block a user