From b899c875c907021d9b81f87741c50a1a95b31f4e Mon Sep 17 00:00:00 2001 From: Niam Patel Date: Sat, 8 Mar 2025 02:27:46 +0000 Subject: [PATCH] Add show-all flag to glossary() and test-case --- glossy/src/gloss.typ | 7 ++++++- glossy/tests/show-all/test.typ | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 glossy/tests/show-all/test.typ diff --git a/glossy/src/gloss.typ b/glossy/src/gloss.typ index 055a294..fdcd841 100644 --- a/glossy/src/gloss.typ +++ b/glossy/src/gloss.typ @@ -603,6 +603,7 @@ sort: true, ignore-case: false, groups: (), + show-all: false, ) = context { // Type checking let checked-title = z.parse(title, z.content(), scope: ("title",)) @@ -613,7 +614,11 @@ // Collect and organize entries by group let output = (:) let all_entries = __gloss_entries.final() - let all_used = all_entries.keys().filter(key => __is_term_ever_used(key)) + let all_used = if not show-all { + all_entries.keys().filter(key => __is_term_ever_used(key)) + } else { + all_entries.keys() + } // Determine which groups to process let all_groups = all_entries diff --git a/glossy/tests/show-all/test.typ b/glossy/tests/show-all/test.typ new file mode 100644 index 0000000..7dcc234 --- /dev/null +++ b/glossy/tests/show-all/test.typ @@ -0,0 +1,33 @@ +#import "/lib.typ": * + +#show: init-glossary.with(( + one: "this is term one", + two: "term two also" +)) + +#set page( + margin: 1em, + width: 3.5in, + height: auto, +) +#set text(size: 10pt) + +In this document we don't reference our glossary items but expect them to be +shown anyway. + +#glossary(show-all: true) + +#glossary( + theme: theme-chicago-index, + show-all: true +) + +#glossary( + theme: theme-compact, + show-all: true +) + +#glossary( + theme: theme-table, + show-all: true +)