Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
> definition, whereas the long in `#gls(...)` refers to the "long form" of the
> entry's output.

> [!TIP]
> A new utility `print-gloss` has been added to allow printing the default's
> formatting for a single entry. This is useful when you want to print
> a single entry outside of `print-glossary`.
> Fixes #166.

## 0.5.9

Expand Down
2 changes: 2 additions & 0 deletions glossarium.typ
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
make-glossary,
register-glossary,
reset-counts,
print-gloss,
print-glossary,
gls-key,
gls-short,
Expand All @@ -32,4 +33,5 @@
Gls,
Glspl,
style-entries,
//
)
4 changes: 4 additions & 0 deletions tests/print-gloss/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# generated by tytanic, do not edit

diff/**
out/**
Binary file added tests/print-gloss/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions tests/print-gloss/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#import "../../themes/default.typ": *
#let entry-list = (
(key: "foo", description: "This is the foo entry."),
(key: "bar", long: "longbar", description: "This is the bar entry."),
(key: "baz"),
(key: "qux"),
)
#register-glossary(entry-list)
#show: make-glossary

#print-glossary(entry-list, show-all: true)

= Tests

@foo

@bar @qux

Reprint foo's entry.
#print-gloss("foo")

Reprint bar's entry.
#print-gloss("bar")
22 changes: 22 additions & 0 deletions themes/default.typ
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,28 @@
use-key-as-short: use-key-as-short,
)

#let print-gloss(
key,
show-all: false,
disable-back-references: false,
deduplicate-back-references: false,
minimum-refs: 0, // Default to 0 to always print
description-separator: ": ",
user-print-title: default-print-title,
user-print-description: default-print-description,
user-print-back-references: default-print-back-references,
) = context default-print-gloss(
__get_entry_with_key(here(), key),
show-all: show-all,
disable-back-references: disable-back-references,
deduplicate-back-references: deduplicate-back-references,
minimum-refs: minimum-refs,
description-separator: description-separator,
user-print-title: user-print-title,
user-print-description: user-print-description,
user-print-back-references: user-print-back-references,
)

#let _print-glossary(
entry-list,
groups: (),
Expand Down