test(glossy): switch to typst-test, add tests
- move examples/readme.typ into a test (demo) - add test for sorting (both ways) - add test to generate theme gallery - add theme gallery image to README
This commit is contained in:
11 files changed
+99
-47
No files matched your search
@@ -0,0 +1,2 @@
|
||||
tests/**/out/
|
||||
tests/**/diff/
|
||||
@@ -178,52 +178,10 @@ Control how terms appear in the document by providing a custom `show-term` funct
|
||||
|
||||
#### Included Themes
|
||||
|
||||
Glossy comes with several built-in themes that can be used directly or serve as examples for custom themes:
|
||||
Glossy comes with several built-in themes that can be used directly or serve as
|
||||
examples for custom themes:
|
||||
|
||||
##### theme-twocol
|
||||
|
||||
A professional two-column layout ideal for technical documentation. Features:
|
||||
|
||||
- Two-column layout for efficient space usage
|
||||
- Dotted leaders to page numbers
|
||||
- Clear hierarchy with optional group headings
|
||||
- Compact but readable formatting
|
||||
- Terms in regular weight with long forms and descriptions inline
|
||||
|
||||
```typst
|
||||
#glossary(theme: theme-twocol)
|
||||
```
|
||||
|
||||
##### theme-basic
|
||||
|
||||
A traditional single-column layout similar to book glossaries. Features:
|
||||
|
||||
- Bold terms with indented content
|
||||
- Clear separation between entries
|
||||
- Hanging indentation for wrapped lines
|
||||
- Parenthetical long forms
|
||||
- Page numbers with "pp." prefix
|
||||
- Simple, clean design
|
||||
|
||||
```typst
|
||||
#glossary(theme: theme-basic)
|
||||
```
|
||||
|
||||
##### theme-compact
|
||||
|
||||
A space-efficient layout perfect for technical documents or appendices. Features:
|
||||
|
||||
- Reduced vertical spacing
|
||||
- Smaller font sizes for secondary information
|
||||
- Color-coded term components
|
||||
- Grid-based alignment
|
||||
- Minimal decorative elements
|
||||
- Gray text for supplementary information
|
||||
- Bullet separators between components
|
||||
|
||||
```typst
|
||||
#glossary(theme: theme-compact)
|
||||
```
|
||||

|
||||
|
||||
#### Custom Themes
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 606 KiB |
@@ -1,6 +1,6 @@
|
||||
// a minimal example, also listed in the README
|
||||
|
||||
#import "@preview/glossy:0.2.1": *
|
||||
#import "/lib.typ": *
|
||||
|
||||
#let myGlossary = (
|
||||
html: (
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 259 KiB |
@@ -0,0 +1,38 @@
|
||||
#import "/lib.typ": *
|
||||
|
||||
#let myGlossary = (
|
||||
html: (
|
||||
short: "HTML",
|
||||
long: "Hypertext Markup Language",
|
||||
description: "A standard language for creating web pages",
|
||||
),
|
||||
iphone: (
|
||||
short: "iPhone",
|
||||
long: "iPhone",
|
||||
),
|
||||
css: (
|
||||
short: "CSS",
|
||||
long: "Cascading Style Sheets",
|
||||
description: "A language used for describing the presentation of a document",
|
||||
),
|
||||
atom: (
|
||||
short: "atom",
|
||||
long: "atom",
|
||||
),
|
||||
tps: (
|
||||
short: "TPS",
|
||||
long: "test procedure specification",
|
||||
description: "A document on how to run all the test procedures"
|
||||
),
|
||||
)
|
||||
|
||||
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
|
||||
|
||||
= Refer to our terms so they show up in the glossary
|
||||
@html, @iphone:long, @css, @css:cap:pl, @atom:pl, @tps:long
|
||||
|
||||
= Default sorting
|
||||
#glossary(theme: theme-compact)
|
||||
|
||||
= Case-insensitive sorting (`ignore-case: true`)
|
||||
#glossary(ignore-case: true, theme: theme-compact)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 339 KiB |
@@ -0,0 +1,54 @@
|
||||
#import "/lib.typ": *
|
||||
|
||||
#let myGlossary = (
|
||||
html: (
|
||||
short: "HTML",
|
||||
long: "Hypertext Markup Language",
|
||||
description: "A standard language for creating web pages",
|
||||
),
|
||||
css: (
|
||||
short: "CSS",
|
||||
long: "Cascading Style Sheets",
|
||||
description: "A language used for describing the presentation of a document",
|
||||
),
|
||||
tps: (
|
||||
short: "TPS",
|
||||
long: "test procedure specification",
|
||||
description: "A document on how to run all the test procedures"
|
||||
),
|
||||
)
|
||||
|
||||
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
|
||||
|
||||
#text(size: 18pt, weight: "bold")[Theme Gallery]
|
||||
|
||||
First, we refer to each term at least once so they'll actually show up in the
|
||||
glossaries. Our terms include: @html:cap, @css, and @tps.
|
||||
|
||||
// TODO: ask Discord if there's a way to get a symbol (ie function) name as a
|
||||
// TODO: figure out if there's a way to get a symbol (ie function) name as a
|
||||
// string or content
|
||||
#let themes = (
|
||||
("theme-basic", theme-basic),
|
||||
("theme-compact", theme-compact),
|
||||
)
|
||||
|
||||
#for theme in themes {
|
||||
block(
|
||||
breakable: false,
|
||||
spacing: 2em,
|
||||
inset: 1em,
|
||||
stroke: 1pt+gray,
|
||||
glossary(title: raw(theme.first()), theme: theme.last())
|
||||
)
|
||||
}
|
||||
|
||||
// HACK: special case theme-twocol so we can restrict the height
|
||||
#block(
|
||||
breakable: false,
|
||||
spacing: 2em,
|
||||
inset: 1em,
|
||||
stroke: 1pt+gray,
|
||||
height: 1.5in,
|
||||
glossary(title: raw("theme-twocol"), theme: theme-twocol)
|
||||
)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@@ -8,4 +8,4 @@ description = "A very simple glossary system with easily customizable output."
|
||||
categories = ["model"]
|
||||
keywords = ["glossary", "index", "dictionary", "gloss"]
|
||||
repository = "https://github.com/swaits/typst-collection"
|
||||
exclude = ["thumbnail.png", "examples/readme.pdf"]
|
||||
exclude = ["thumbnail.png", "themeshots.pjng", "tests"]
|
||||
Reference in new issue
Block a user