🚨 LOCKDOWN: Repository migration in progress

DO NOT CREATE NEW ISSUES OR PULL REQUESTS HERE

All packages are moving to: https://github.com/swaits-typst-packages
Existing issues and PRs are being migrated.

This is a temporary lockdown while migration is completed.
This commit is contained in:
swaits committed 2025-10-26 21:22:33 -06:00
1 parent b84900ffc1
commit 38d33d3c8a
52 files changed
+1279 -664

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 KiB

After

Width:  |  Height:  |  Size: 104 KiB

+47 -15
View File
@@ -6,10 +6,11 @@
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"),
description: "A document on how to run all the test procedures",
),
)
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
#show: init-glossary.with(myGlossary, show-term: body => [#emph(body)])
#set heading(numbering: "1.1")
#set page(numbering: "1")
@@ -40,18 +41,51 @@ Now make sure I get your @tps:short reports by 2pm!
== Using conflicting modifiers (short, long, both)
These modifiers are semantically mutually exclusive, by they can be combined
syntactically. When multiple are used, `glossy` tries to make a smart choice on
which one to display.
These modifiers are semantically mutually exclusive. When multiple are used,
`glossy` throws an error to the compiler, explaining the problem.
#import "/src/gloss.typ": __default-format-term, __gls
#let manual-gls(key, mods) = __gls(
key,
modes-modifiers: mods,
format-term: __default-format-term,
show-term: body => [#strong(body)],
term-links: false,
display-text: none,
)
#assert-panic(manual-gls.with("tps", ("short", "long")))
#let msg-short-long = "panicked with: \"Cannot mix modes \", (\"short\", \"long\"), \", pick one.\""
#let msg-short-both = "panicked with: \"Cannot mix modes \", (\"short\", \"both\"), \", pick one.\""
#let msg-long-both = "panicked with: \"Cannot mix modes \", (\"long\", \"both\"), \", pick one.\""
#let msg-short-long-both = "panicked with: \"Cannot mix modes \", (\"short\", \"long\", \"both\"), \", pick one.\""
#table(
columns: 2,
table.header([*Input*], [*Output*]),
table.header([*Input*], [*Error*]),
[`@tps:short:long` ], [@tps:short:long],
[`@tps:short:both` ], [@tps:short:both],
[`@tps:long:both` ], [@tps:long:both],
[`@tps:short:long:both`], [@tps:short:long:both],
[`@tps:short:long` ],
[#assert.eq(
catch(manual-gls.with("tps", ("short", "long"))),
msg-short-long,
)#msg-short-long],
[`@tps:short:both` ],
[#assert.eq(
catch(manual-gls.with("tps", ("short", "both"))),
msg-short-both,
)#msg-short-both],
[`@tps:long:both` ],
[#assert.eq(
catch(manual-gls.with("tps", ("long", "both"))),
msg-long-both,
)#msg-long-both],
[`@tps:short:long:both`],
[#assert.eq(
catch(manual-gls.with("tps", ("short", "long", "both"))),
msg-short-long-both,
)#msg-short-long-both],
)
#let my-theme = (
@@ -77,12 +111,10 @@ which one to display.
block(
grid(
columns: (auto, 1fr, auto),
output,
repeat([#h(0.25em) . #h(0.25em)]),
entry.pages,
)
output, repeat([#h(0.25em) . #h(0.25em)]), entry.pages.join(", "),
),
)
}
},
)
#glossary(theme: my-theme)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 KiB

After

Width:  |  Height:  |  Size: 187 KiB

+62 -20
View File
@@ -7,20 +7,23 @@
short: "HTML",
long: "Hypertext Markup Language",
description: "A standard language for creating web pages",
group: "Web"),
group: "Web",
),
css: (
short: "CSS",
long: "Cascading Style Sheets",
description: "A language used for describing the presentation of a document",
group: "Web"),
group: "Web",
),
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"),
unused: "Unused term, which shouldn't print in the glossary."
description: "A document on how to run all the test procedures",
),
unused: "Unused term, which shouldn't print in the glossary.",
)
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
#show: init-glossary.with(myGlossary, show-term: body => [#emph(body)])
#set heading(numbering: "1.1")
#set page(height: auto, width: 6.5in, margin: 1em, numbering: "1")
@@ -78,18 +81,51 @@ Articles are incompatible with the `pl` (plural) modifier.
== Using conflicting modifiers (short, long, both)
These modifiers are semantically mutually exclusive, by they can be combined
syntactically. When multiple are used, `glossy` tries to make a smart choice on
which one to display.
These modifiers are semantically mutually exclusive. When multiple are used,
`glossy` throws an error to the compiler, explaining the problem.
#import "/src/gloss.typ": __default-format-term, __gls
#let manual-gls(key, mods) = __gls(
key,
modes-modifiers: mods,
format-term: __default-format-term,
show-term: body => [#strong(body)],
term-links: false,
display-text: none,
)
#assert-panic(manual-gls.with("tps", ("short", "long")))
#let msg-short-long = "panicked with: \"Cannot mix modes \", (\"short\", \"long\"), \", pick one.\""
#let msg-short-both = "panicked with: \"Cannot mix modes \", (\"short\", \"both\"), \", pick one.\""
#let msg-long-both = "panicked with: \"Cannot mix modes \", (\"long\", \"both\"), \", pick one.\""
#let msg-short-long-both = "panicked with: \"Cannot mix modes \", (\"short\", \"long\", \"both\"), \", pick one.\""
#table(
columns: 2,
table.header([*Input*], [*Output*]),
table.header([*Input*], [*Error*]),
[`@tps:short:long` ], [@tps:short:long],
[`@tps:short:both` ], [@tps:short:both],
[`@tps:long:both` ], [@tps:long:both],
[`@tps:short:long:both`], [@tps:short:long:both],
[`@tps:short:long` ],
[#assert.eq(
catch(manual-gls.with("tps", ("short", "long"))),
msg-short-long,
)#msg-short-long],
[`@tps:short:both` ],
[#assert.eq(
catch(manual-gls.with("tps", ("short", "both"))),
msg-short-both,
)#msg-short-both],
[`@tps:long:both` ],
[#assert.eq(
catch(manual-gls.with("tps", ("long", "both"))),
msg-long-both,
)#msg-long-both],
[`@tps:short:long:both`],
[#assert.eq(
catch(manual-gls.with("tps", ("short", "long", "both"))),
msg-short-long-both,
)#msg-short-long-both],
)
#let my-theme = (
@@ -115,14 +151,20 @@ which one to display.
block(
grid(
columns: (auto, 1fr, auto),
output,
repeat([#h(0.25em) . #h(0.25em)]),
entry.pages,
)
output, repeat([#h(0.25em) . #h(0.25em)]), entry.pages.join(", "),
),
)
}
},
)
#glossary(theme: my-theme)
#glossary(title: "Glossary with just empty group", groups: ("",), theme: theme-basic)
#glossary(title: "Glossary with just Web group", groups: ("Web",), theme: theme-compact)
#glossary(
title: "Glossary with just empty group",
groups: ("",),
theme: theme-basic,
)
#glossary(
title: "Glossary with just Web group",
groups: ("Web",),
theme: theme-compact,
)
+244 -255
View File
@@ -2,285 +2,274 @@
#let tests = (
// Main tests (covers most of English language)
("Europe","a"),
("European","a"),
("Hannah","a"),
("T-shirt","a"),
("Xerox","a"),
("Zebra","a"),
("aardvark","an"),
("apple","an"),
("boat","a"),
("car","a"),
("cat","a"),
("chair","a"),
("dog","a"),
("egg","an"),
("elephant","an"),
("emu","an"),
("eucalyptus","a"),
("eulogy","a"),
("euphemism","a"),
("exhausted","an"),
("ghost","a"),
("hat","a"),
("heir","an"),
("heiress","an"),
("herb","an"),
("herbal","an"),
("historic","a"),
("history","a"),
("homage","an"),
("honest","an"),
("honestly","an"),
("honor","an"),
("honorary","an"),
("honour","an"),
("horse","a"),
("hour","an"),
("hourglass","an"),
("house","a"),
("iris","an"),
("orange","an"),
("owl","an"),
("table","a"),
("ugly","an"),
("umbrella","an"),
("umpire","an"),
("unicorn","a"),
("unique","a"),
("university","a"),
("urn","an"),
("usage","a"),
("user","a"),
("utensil","a"),
("Europe", "a"),
("European", "a"),
("Hannah", "a"),
("T-shirt", "a"),
("Xerox", "a"),
("Zebra", "a"),
("aardvark", "an"),
("apple", "an"),
("boat", "a"),
("car", "a"),
("cat", "a"),
("chair", "a"),
("dog", "a"),
("egg", "an"),
("elephant", "an"),
("emu", "an"),
("eucalyptus", "a"),
("eulogy", "a"),
("euphemism", "a"),
("exhausted", "an"),
("ghost", "a"),
("hat", "a"),
("heir", "an"),
("heiress", "an"),
("herb", "an"),
("herbal", "an"),
("historic", "a"),
("history", "a"),
("homage", "an"),
("honest", "an"),
("honestly", "an"),
("honor", "an"),
("honorary", "an"),
("honour", "an"),
("horse", "a"),
("hour", "an"),
("hourglass", "an"),
("house", "a"),
("iris", "an"),
("orange", "an"),
("owl", "an"),
("table", "a"),
("ugly", "an"),
("umbrella", "an"),
("umpire", "an"),
("unicorn", "a"),
("unique", "a"),
("university", "a"),
("urn", "an"),
("usage", "a"),
("user", "a"),
("utensil", "a"),
// Acronym tests
("ASCII","an"),
("CFO","a"),
("F.A.Q.","an"),
("FBI","an"),
("GIF","a"),
("HIV","an"),
("JPEG","a"),
("LED","an"),
("MRI","an"),
("NATO","an"),
("PNG","a"),
("Q&A","a"),
("RF","an"),
("RNG","an"),
("SAS","an"),
("SMS","an"),
("SOS","an"),
("SQL","an"),
("UFO","a"),
("URL","a"),
("VCR","a"),
("WWW","a"),
("X.Y.Z.","an"),
("YAML","a"),
("ASCII", "an"),
("CFO", "a"),
("F.A.Q.", "an"),
("FBI", "an"),
("GIF", "a"),
("HIV", "an"),
("JPEG", "a"),
("LED", "an"),
("MRI", "an"),
("NATO", "an"),
("PNG", "a"),
("Q&A", "a"),
("RF", "an"),
("RNG", "an"),
("SAS", "an"),
("SMS", "an"),
("SOS", "an"),
("SQL", "an"),
("UFO", "a"),
("URL", "a"),
("VCR", "a"),
("WWW", "a"),
("X.Y.Z.", "an"),
("YAML", "a"),
// Extra tests (courtesy of LLM)
// Common English words starting with vowels
("idea","an"),
("island","an"),
("offer","an"),
("option","an"),
("operation","an"),
("appletree","an"),
("iguana","an"),
("octopus","an"),
("atom","an"),
("item","an"),
("idea", "an"),
("island", "an"),
("offer", "an"),
("option", "an"),
("operation", "an"),
("appletree", "an"),
("iguana", "an"),
("octopus", "an"),
("atom", "an"),
("item", "an"),
// Words starting with vowel but "yoo" sound (thus 'a')
("universe","a"),
("unicycle","a"),
("uniform","a"),
("union","a"),
("united","a"),
("unique","a"), // already tested, reaffirmed
("usual","a"),
("useful","a"),
("utility","a"),
("utopia","a"),
("universe", "a"),
("unicycle", "a"),
("uniform", "a"),
("union", "a"),
("united", "a"),
("unique", "a"), // already tested, reaffirmed
("usual", "a"),
("useful", "a"),
("utility", "a"),
("utopia", "a"),
// More common vowel words with a/an
("umbrella","an"), // repeated but reaffirming
("eggplant","an"),
("insect","an"),
("eleven","an"),
("olive","an"),
("impulse","an"),
("ox","an"),
("aroma","an"),
("ear","an"),
("ocean","an"),
("umbrella", "an"), // repeated but reaffirming
("eggplant", "an"),
("insect", "an"),
("eleven", "an"),
("olive", "an"),
("impulse", "an"),
("ox", "an"),
("aroma", "an"),
("ear", "an"),
("ocean", "an"),
// Words starting with 'h' but pronounced, so 'a'
("house","a"), // repeated for emphasis
("hammer","a"),
("helmet","a"),
("history","a"), // repeated
("hero","a"),
("hill","a"),
("hobby","a"),
("holiday","a"),
("harmony","a"),
("hover","a"),
("house", "a"), // repeated for emphasis
("hammer", "a"),
("helmet", "a"),
("history", "a"), // repeated
("hero", "a"),
("hill", "a"),
("hobby", "a"),
("holiday", "a"),
("harmony", "a"),
("hover", "a"),
// More silent 'h' words (already in set, but variations)
("honorific","an"),
("honorarium","an"),
("honesties","an"),
("hourly","an"),
("heirloom","an"),
("honorific", "an"),
("honorarium", "an"),
("honesties", "an"),
("hourly", "an"),
("heirloom", "an"),
// Words starting with 'e' + 'u' combo with "yoo" sound
("Europe","a"), // repeated
("European","a"), // repeated
("euphoric","a"),
("eureka","a"),
("euphemistic","a"),
("euphonious","a"),
("eucalyptus","a"), // repeated
("euthanasia","a"),
("eugenics","a"),
("Eurasia","a"),
("Europe", "a"), // repeated
("European", "a"), // repeated
("euphoric", "a"),
("eureka", "a"),
("euphemistic", "a"),
("euphonious", "a"),
("eucalyptus", "a"), // repeated
("euthanasia", "a"),
("eugenics", "a"),
("Eurasia", "a"),
// Common consonant-start words
("book","a"),
("pen","a"),
("fork","a"),
("spoon","a"),
("knife","a"),
("ball","a"),
("tree","a"),
("river","a"),
("mountain","a"),
("cloud","a"),
("book", "a"),
("pen", "a"),
("fork", "a"),
("spoon", "a"),
("knife", "a"),
("ball", "a"),
("tree", "a"),
("river", "a"),
("mountain", "a"),
("cloud", "a"),
// More vowel-start words
("ostrich","an"),
("amphibian","an"),
("eleven","an"), // repeated
("issue","an"),
("incense","an"),
("antenna","an"),
("echo","an"),
("aisle","an"),
("oracle","an"),
("overcoat","an"),
("ostrich", "an"),
("amphibian", "an"),
("eleven", "an"), // repeated
("issue", "an"),
("incense", "an"),
("antenna", "an"),
("echo", "an"),
("aisle", "an"),
("oracle", "an"),
("overcoat", "an"),
// More acronym/initialism tests:
("ATM","an"), // A = 'ay'
("EPA","an"), // E = 'ee'
("FAQ","an"), // F = 'eff', repeated as F.A.Q.
("HTML","an"), // H = 'aitch'
("IBM","an"), // I = 'eye'
("LAN","an"), // L = 'el'
("NFL","an"), // N = 'en'
("OSHA","an"), // O = 'oh'
("RAM","an"), // R = 'ar'
("SMS","an"), // repeated, S = 'ess'
("ATM", "an"), // A = 'ay'
("EPA", "an"), // E = 'ee'
("FAQ", "an"), // F = 'eff', repeated as F.A.Q.
("HTML", "an"), // H = 'aitch'
("IBM", "an"), // I = 'eye'
("LAN", "an"), // L = 'el'
("NFL", "an"), // N = 'en'
("OSHA", "an"), // O = 'oh'
("RAM", "an"), // R = 'ar'
("SMS", "an"), // repeated, S = 'ess'
// Acronyms starting with consonant sound letters
("GIF","a"), // G = 'jee', repeated
("CFO","a"), // C = 'see', repeated (consonant sound 's')
("CEO","a"), // C = 'see'
("DNA","a"), // D = 'dee' starts with 'd' consonant sound
("PGA","a"), // P = 'pee' starts with 'p' consonant sound
("QVC","a"), // Q = 'kyoo' starts with 'k' consonant sound
("TNT","a"), // T = 'tee' starts with 't' consonant sound
("UPS","a"), // U = 'yoo' sound, hence 'a'
("VIP","a"), // V = 'vee' starts with 'v' consonant sound
("WIPO","a"), // W = 'double-u' starts with 'd' consonant sound
("GIF", "a"), // G = 'jee', repeated
("CFO", "a"), // C = 'see', repeated (consonant sound 's')
("CEO", "a"), // C = 'see'
("DNA", "a"), // D = 'dee' starts with 'd' consonant sound
("PGA", "a"), // P = 'pee' starts with 'p' consonant sound
("QVC", "a"), // Q = 'kyoo' starts with 'k' consonant sound
("TNT", "a"), // T = 'tee' starts with 't' consonant sound
("UPS", "a"), // U = 'yoo' sound, hence 'a'
("VIP", "a"), // V = 'vee' starts with 'v' consonant sound
("WIPO", "a"), // W = 'double-u' starts with 'd' consonant sound
// More tricky 'u' words with 'yoo' sound for 'a'
("unify","a"),
("unilateral","a"),
("ubiquitous","a"), // 'yoo-bik...'
("usurp","a"),
("usuary","a"), // 'yoo-zhoo-ary' (rare, but treat like usual)
("uterus","a"), // 'yoo-terus'
("usher","an"), // 'uh-sher' vowel sound
("ugly","an"), // repeated, 'uh-glee'
("upper","an"), // 'uh-pur' (vowel sound but actually 'uh' sound = 'an'? Actually "upper" starts with a simple vowel sound 'uh', so should it be 'an'? It's commonly "an upper hand".
("update","an"), // 'up-date' starts with 'uh' vowel sound → 'an update' normally. Actually we say "an update" commonly. Correcting to 'an':
("unify", "a"),
("unilateral", "a"),
("ubiquitous", "a"), // 'yoo-bik...'
("usurp", "a"),
("usuary", "a"), // 'yoo-zhoo-ary' (rare, but treat like usual)
("uterus", "a"), // 'yoo-terus'
("usher", "an"), // 'uh-sher' vowel sound
("ugly", "an"), // repeated, 'uh-glee'
("upper", "an"), // 'uh-pur' (vowel sound but actually 'uh' sound = 'an'? Actually "upper" starts with a simple vowel sound 'uh', so should it be 'an'? It's commonly "an upper hand".
("update", "an"), // 'up-date' starts with 'uh' vowel sound → 'an update' normally. Actually we say "an update" commonly. Correcting to 'an':
// Words starting with 'u' that actually take "an"
// (because they start with a vowel sound 'uh'):
("under","an"),
("understand","an"),
("unusual","an"),
("unreal","an"),
("unemployed","an"),
("unequal","an"),
("unopened","an"),
("unarmed","an"),
("uneasy","an"),
("united","a"), // 'yoo-nited' is 'a united front'
("universal","a"),
("umbrella","an"), // repeated
("upset","an"), // 'uh-pset' vowel start
("under", "an"),
("understand", "an"),
("unusual", "an"),
("unreal", "an"),
("unemployed", "an"),
("unequal", "an"),
("unopened", "an"),
("unarmed", "an"),
("uneasy", "an"),
("united", "a"), // 'yoo-nited' is 'a united front'
("universal", "a"),
("umbrella", "an"), // repeated
("upset", "an"), // 'uh-pset' vowel start
// More vowel words to ensure coverage:
("animal","an"),
("image","an"),
("order","an"),
("arrow","an"),
("ace","an"),
("acre","an"),
("agent","an"),
("artist","an"),
("idea","an"), // repeated
("aim","an"),
("item","an"), // repeated
("isotope","an"),
("opera","an"),
("animal", "an"),
("image", "an"),
("order", "an"),
("arrow", "an"),
("ace", "an"),
("acre", "an"),
("agent", "an"),
("artist", "an"),
("idea", "an"), // repeated
("aim", "an"),
("item", "an"), // repeated
("isotope", "an"),
("opera", "an"),
// Words starting with vowels but pronounced with consonant sound 'y' → 'a'
("euphemistic","a"), // repeated
("euphoric","a"),
("eulogy","a"), // repeated
("Europe","a"), // repeated
("European","a"), // repeated
("eugenics","a"), // repeated
("euphemism","a"), // repeated
("eureka","a"), // repeated
("euphonious","a"),
("Eurasia","a"),
("euphemistic", "a"), // repeated
("euphoric", "a"),
("eulogy", "a"), // repeated
("Europe", "a"), // repeated
("European", "a"), // repeated
("eugenics", "a"), // repeated
("euphemism", "a"), // repeated
("eureka", "a"), // repeated
("euphonious", "a"),
("Eurasia", "a"),
// Common consonant-start words:
("milk","a"),
("road","a"),
("stone","a"),
("book","a"), // repeated
("pen","a"), // repeated
("fork","a"), // repeated
("spoon","a"), // repeated
("knife","a"), // 'knife' actually starts with /n/ sound because 'k' is silent. "a knife" or "an knife"? It's "a knife" (starts with 'n' consonant sound?), actually 'kn' in 'knife' is silent, so 'knife' is pronounced 'nife' with a consonant sound 'n', so "a knife" is correct.
("glass","a"),
("window","a"),
("milk", "a"),
("road", "a"),
("stone", "a"),
("book", "a"), // repeated
("pen", "a"), // repeated
("fork", "a"), // repeated
("spoon", "a"), // repeated
("knife", "a"), // 'knife' actually starts with /n/ sound because 'k' is silent. "a knife" or "an knife"? It's "a knife" (starts with 'n' consonant sound?), actually 'kn' in 'knife' is silent, so 'knife' is pronounced 'nife' with a consonant sound 'n', so "a knife" is correct.
("glass", "a"),
("window", "a"),
// Final checks with tricky silent letters:
("gnome","a"), // 'g' silent, pronounced 'nome' with 'n' consonant sound → 'a gnome'
("gnat","a"), // 'nat' consonant sound → 'a gnat'
("xylophone","a"), // 'zylophone' → 'z' consonant sound → 'a xylophone'
("xenon","a"), // 'zee-non' consonant sound 'z' → 'a xenon'
("honorific","an"), // repeated but reaffirming
("hourly","an"), // repeated but reaffirming
("honorably","an"),
("honorifics","an"),
("honors","an"),
("gnome", "a"), // 'g' silent, pronounced 'nome' with 'n' consonant sound → 'a gnome'
("gnat", "a"), // 'nat' consonant sound → 'a gnat'
("xylophone", "a"), // 'zylophone' → 'z' consonant sound → 'a xylophone'
("xenon", "a"), // 'zee-non' consonant sound 'z' → 'a xenon'
("honorific", "an"), // repeated but reaffirming
("hourly", "an"), // repeated but reaffirming
("honorably", "an"),
("honorifics", "an"),
("honors", "an"),
)
#for (word, article) in tests {
let chosen = __determine_article(word)
if chosen != article {
panic("bad choice! word: " + word + ", article: " + article + ", chosen: " + chosen)
panic(
"bad choice! word: "
+ word
+ ", article: "
+ article
+ ", chosen: "
+ chosen,
)
}
}
+34 -25
View File
@@ -5,20 +5,24 @@
short: "HTML",
long: "Hypertext Markup Language",
description: "A standard language for creating web pages",
group: "Web"),
group: "Web",
),
css: (
short: "CSS",
long: "Cascading Style Sheets",
description: "A language used for describing the presentation of a document",
group: "Web"),
group: "Web",
),
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"),
description: "A document on how to run all the test procedures",
),
concise: "Concise syntax!",
shortonly: (
short: "shortonly!!!"),
unused: "Unused term, which shouldn't print in the glossary."
short: "shortonly!!!",
),
unused: "Unused term, which shouldn't print in the glossary.",
)
#set page(width: 6.5in, height: auto, margin: 1em)
@@ -26,23 +30,21 @@
#let test-content = {
table(
columns: 3,
table.header(
[`short`], [`long`], [`both`],
),
table.header([`short`], [`long`], [`both`]),
[@html:short], [@html:long], [@html:both],
[@css:short], [@css:long], [@css:both],
[@tps:short], [@tps:long], [@tps:both],
[@concise:short], [@concise:long], [@concise:both],
[@html:short], [@html:long], [@html:both],
[@css:short], [@css:long], [@css:both],
[@tps:short], [@tps:long], [@tps:both:nouse],
[@concise:short], [@concise:long], [@concise:both],
[@shortonly:short], [@shortonly:long], [@shortonly:both],
table.hline(stroke: 2pt),
[@html:short:cap], [@html:long:cap], [@html:both:cap],
[@a:css:short], [@a:css:long], [@a:css:both],
[@tps:short:pl], [@tps:long:pl], [@tps:both:pl],
[@concise:a:cap:short], [@concise:a:cap:long], [@concise:a:cap:both],
[@an:shortonly:short], [@an:shortonly:long], [@an:shortonly:both],
[@html:short:cap], [@html:long:cap], [@html:both:cap],
[@a:css:short], [@a:css:long], [@a:css:both],
[@tps:short:pl], [@tps:long:pl], [@tps:both:nouse:pl],
[@concise:a:cap:short], [@concise:a:cap:long], [@concise:a:cap:both],
[@an:shortonly:short], [@an:shortonly:long], [@an:shortonly:both],
)
[@a:tps:cap is @tps:def.]
@@ -54,7 +56,7 @@
if mode == "short" {
short-form
} else if mode == "long" {
long-form
long-form
} else {
long-form + " (" + short-form + ")"
}
@@ -79,7 +81,7 @@
// ---------------------------------------------------------------------------------
#let format-uppercase-short(mode, short-form, long-form) = {
let short-up = upper(short-form);
let short-up = upper(short-form)
if mode == "short" {
short-up
} else if mode == "long" {
@@ -108,8 +110,8 @@
// ---------------------------------------------------------------------------------
#let format-conditional-separator(mode, short-form, long-form) = {
let separator = if short-form.len() > 4 { " / " } else { ", " };
let has_long = long-form != none and long-form != "";
let separator = if short-form.len() > 4 { " / " } else { ", " }
let has_long = long-form != none and long-form != ""
if mode == "short" {
short-form
@@ -124,7 +126,10 @@
}
}
#init-glossary(myGlossary, format-term: format-conditional-separator)[#test-content]
#init-glossary(
myGlossary,
format-term: format-conditional-separator,
)[#test-content]
// ---------------------------------------------------------------------------------
// 1. Braces and Labels
@@ -145,7 +150,9 @@
// 2. Mode-Based Prefix
// Idea: Add a prefix indicating the mode, and then show the term(s).
#let format-mode-prefix(mode, short-form, long-form) = {
let prefix = if mode == "short" { "S:" } else if mode == "long" { "L:" } else { "B:" };
let prefix = if mode == "short" { "S:" } else if mode == "long" {
"L:"
} else { "B:" }
if mode == "short" {
prefix + short-form
} else if mode == "long" {
@@ -161,7 +168,7 @@
// 3. Conditional Fallback for Missing Long
// Idea: If no long-form is provided, use the short-form in all cases.
#let format-fallback-long(mode, short-form, long-form) = {
let has_long = long-form != none and long-form != "";
let has_long = long-form != none and long-form != ""
if mode == "short" {
short-form
} else if mode == "long" {
@@ -193,7 +200,9 @@
// Idea: In both mode, append the length of each string.
#let format-length-info(mode, short-form, long-form) = {
let s_len = str(short-form.len())
let l_len = if long-form != none and long-form != "" { str(long-form.len()) } else { "0" }
let l_len = if long-form != none and long-form != "" {
str(long-form.len())
} else { "0" }
if mode == "short" {
short-form + " [len:" + s_len + "]"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 99 KiB

+3 -3
View File
@@ -1,5 +1,5 @@
#import "/lib.typ": *
#import "@preview/glossarium:0.5.3": *
#import "@preview/glossarium:0.5.9": *
#set page(height: auto, width: 4.5in)
#show link: set text(fill: red)
@@ -19,7 +19,7 @@
This should be a link, too: @WWW
#glossary()
]
],
)
// -----------------------------------------------------------------------------
@@ -41,5 +41,5 @@
This should be a link, too: @ML
#print-glossary(entry-list)
]
],
)
+6 -6
View File
@@ -12,22 +12,22 @@ Reference: @pbr, @zbuffer
]
#t("abbreviations") // "string" : str
#t(("abbreviations")) // ("string") : str
#t("abbreviations") // ("string") : str
#t(("abbreviations",)) // ("string",) : array(str)
#t(("abbreviations","abbreviations")) // ("string","string",) : array(str)
#t(("abbreviations", "abbreviations")) // ("string","string",) : array(str)
#pagebreak(weak: true)
#t("") // empty string should be the empty group
#t(("")) // empty string should be the empty group
#t("") // empty string should be the empty group
#t(("",)) // empty string should be the empty group
#t(("","")) // empty string should be the empty group
#t(("", "")) // empty string should be the empty group
#pagebreak(weak: true)
#t(none) // none should be all groups
#t((none)) // none should be all groups
#t(none) // none should be all groups
#pagebreak(weak: true)
#t(("abbreviations",none)) // try to get both groups
#t(("abbreviations", none)) // try to get both groups
+9 -6
View File
@@ -5,17 +5,20 @@
short: "HTML",
long: "Hypertext Markup Language",
description: "A standard language for creating web pages",
group: "Web"),
group: "Web",
),
css: (
short: "CSS",
long: "Cascading Style Sheets",
description: "A language used for describing the presentation of a document",
group: "Web"),
group: "Web",
),
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"),
unused: "Unused term, which shouldn't print in the glossary."
description: "A document on how to run all the test procedures",
),
unused: "Unused term, which shouldn't print in the glossary.",
)
#show: init-glossary.with(myGlossary)
@@ -24,9 +27,9 @@
= Hiding terms
Here's a hidden term: @html:hide
Here's a hidden term: @html[]
Here's another hidden term: @css:hidden
Here's another hidden term: @css[]
And here's a shown term: @tps
+1 -1
View File
@@ -1,4 +1,4 @@
#import "/lib.typ":*
#import "/lib.typ": *
#show: init-glossary.with(yaml("glossary.yml"))
+4 -4
View File
@@ -2,10 +2,10 @@
// 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",
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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 27 KiB

+7 -4
View File
@@ -5,17 +5,20 @@
short: "HTML",
long: "Hypertext Markup Language",
description: "A standard language for creating web pages",
group: "Web"),
group: "Web",
),
css: (
short: "CSS",
long: "Cascading Style Sheets",
description: "A language used for describing the presentation of a document",
group: "Web"),
group: "Web",
),
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"),
unused: "Unused term, which shouldn't print in the glossary."
description: "A document on how to run all the test procedures",
),
unused: "Unused term, which shouldn't print in the glossary.",
)
#show: init-glossary.with(myGlossary)
+1 -1
View File
@@ -20,7 +20,7 @@
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"
description: "A document on how to run all the test procedures",
),
)
+5 -5
View File
@@ -294,11 +294,11 @@
if result != expected {
panic(
"Pluralization failed for: "
+ (if singular == none { "none" } else { str(singular) })
+ ". Expected: "
+ (if expected == none { "none" } else { str(expected) })
+ ", got: "
+ (if result == none { "none" } else { str(result) })
+ (if singular == none { "none" } else { str(singular) })
+ ". Expected: "
+ (if expected == none { "none" } else { str(expected) })
+ ", got: "
+ (if result == none { "none" } else { str(result) }),
)
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

+78 -60
View File
@@ -37,79 +37,68 @@
short: "HTML",
long: "Hypertext Markup Language",
description: "A standard language for creating web pages",
group: "Web"
group: "Web",
),
css: (
short: "CSS",
long: "Cascading Style Sheets",
description: "A language used for describing the presentation of documents",
group: "Web"
group: "Web",
),
// Term with no description
js: (
short: "JS",
long: "JavaScript",
group: "Web"
group: "Web",
),
// Term with only a short field
tcp: (
short: "TCP",
group: "Networking"
group: "Networking",
),
// Term with only a long field
// should panic!
//udp: (
// long: "User Datagram Protocol",
// group: "Networking"
//),
// Term with short and description, but no long
ip: (
short: "IP",
description: "A unique identifier for a host or network interface",
group: "Networking"
group: "Networking",
),
// Term with custom articles and everything defined
api: (
short: "API",
long: "Application Programming Interface",
description: "A set of protocols and tools for building software",
article: "an", // custom article for short form
longarticle: "an", // custom article for long form
group: "Software"
article: "an", // custom article for short form
longarticle: "an", // custom article for long form
group: "Software",
),
// Term starting with a vowel, no custom article, to test default a/an logic
xml: (
short: "XML",
long: "Extensible Markup Language",
description: "A markup language defining rules for encoding documents",
group: "Data"
group: "Data",
),
// Term starting with a consonant, no custom article
cpu: (
short: "CPU",
long: "Central Processing Unit",
description: "The primary component of a computer that performs calculations",
group: "Hardware"
group: "Hardware",
),
// Term without any fields (just a string), should be handled gracefully
bare: "A bare term with no fields",
// Term with only description
// should panic!
//desconly: (
// description: "Just a description, no short or long",
// group: "Misc"
//),
// Term with article fields but missing short and long (should test fallback)
// should panic!
//articonly: (
@@ -118,51 +107,46 @@
// description: "Has only articles and a description",
// group: "Misc"
//),
// Term with uppercase key
SSL: (
short: "SSL",
long: "Secure Sockets Layer",
description: "A protocol for encrypting information over the internet",
group: "Security"
group: "Security",
),
// Term that will not be referenced
unusedterm: (
short: "UNUSED",
long: "Unused Term",
description: "Should not appear since it's never referenced"
description: "Should not appear since it's never referenced",
),
// Term that tests pluralization with custom fields maybe
doc: (
short: "doc",
long: "document",
description: "A single piece of written matter",
group: "Misc"
group: "Misc",
),
// Terms that might require checking conflicting modifiers
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document describing test procedures",
group: "Testing"
group: "Testing",
),
// Term that might appear multiple times
http: (
short: "HTTP",
long: "Hypertext Transfer Protocol",
description: "A protocol for distributed, collaborative, hypermedia information systems",
group: "Web"
)
group: "Web",
),
)
// Initialize the glossary with a custom show-term callback
#show: init-glossary.with(
exhaustiveGlossary,
show-term: (body) => [#strong(body)]
show-term: body => [#strong(body)],
)
#set heading(numbering: "1.1")
@@ -293,14 +277,32 @@ This document tries all reference forms and modifiers on a large set of terms.
== Conflicting multiple modifiers combined (short, long, both together)
- @tps:short:long
- @tps:short:both
- @tps:long:both
- @tps:short:long:both
- @html:both:long:short
- @doc:long:short
- @cpu:both:long:short
- @api:short:long:both
Assert that a panic occurs.
#import "/src/gloss.typ": __default-format-term, __gls
#let manual-gls(key, mods) = __gls(
key,
modes-modifiers: mods,
format-term: __default-format-term,
show-term: body => [#strong(body)],
term-links: false,
display-text: none,
)
//- @tps:short:long
#assert-panic(manual-gls.with("tps", ("short", "long")))
//- @tps:short:both
#assert-panic(manual-gls.with("tps", ("short", "both")))
//- @tps:long:both
#assert-panic(manual-gls.with("tps", ("long", "both")))
//- @tps:short:long:both
#assert-panic(manual-gls.with("tps", ("short", "long", "both")))
//- @html:both:long:short
#assert-panic(manual-gls.with("html", ("both", "long", "short")))
//- @doc:long:short
#assert-panic(manual-gls.with("doc", ("long", "short")))
//- @cpu:both:long:short
#assert-panic(manual-gls.with("cpu", ("both", "long", "short")))
//- @api:short:long:both
#assert-panic(manual-gls.with("api", ("short", "long", "both")))
== Combining capitalization and plural with short/long/both
@@ -337,19 +339,19 @@ This document tries all reference forms and modifiers on a large set of terms.
#table(
columns: 3,
table.header([*Input*],[*Output*],[*Comment*]),
[`@api` ], [@api], ["default"],
[`@api:short` ], [@api:short], ["short only"],
[`@api:long` ], [@api:long], ["long only"],
[`@api:both` ], [@api:both], ["both"],
[`@api:def` ], [@api:def], ["definition (long)"],
[`@api:desc` ], [@api:desc], ["description"],
[`@a:api` ], [@a:api], ["article before key"],
[`@api:a` ], [@api:a], ["article after key"],
[`@api:cap` ], [@api:cap], ["capitalize"],
[`@api:pl` ], [@api:pl], ["plural"],
[`@api:long:cap`], [@api:long:cap],["long + cap"],
[`@api:both:pl` ], [@api:both:pl], ["both + pl"]
table.header([*Input*], [*Output*], [*Comment*]),
[`@api` ], [@api], ["default"],
[`@api:short` ], [@api:short], ["short only"],
[`@api:long` ], [@api:long], ["long only"],
[`@api:both` ], [@api:both], ["both"],
[`@api:def` ], [@api:def], ["definition (long)"],
[`@api:desc` ], [@api:desc], ["description"],
[`@a:api` ], [@a:api], ["article before key"],
[`@api:a` ], [@api:a], ["article after key"],
[`@api:cap` ], [@api:cap], ["capitalize"],
[`@api:pl` ], [@api:pl], ["plural"],
[`@api:long:cap`], [@api:long:cap], ["long + cap"],
[`@api:both:pl` ], [@api:both:pl], ["both + pl"],
)
== Multiple glossaries with themes and group filtering
@@ -366,25 +368,41 @@ This document tries all reference forms and modifiers on a large set of terms.
== Networking Only
#glossary(title: "Networking Terms", groups: ("Networking",), theme: theme-basic)
#glossary(
title: "Networking Terms",
groups: ("Networking",),
theme: theme-basic,
)
== Misc and Data
#glossary(title: "Misc & Data", groups: ("Misc","Data"), theme: theme-basic)
#glossary(title: "Misc & Data", groups: ("Misc", "Data"), theme: theme-basic)
== Just Testing terms
#glossary(title: "Testing Terms", groups: ("Testing",), theme: theme-chicago-index)
#glossary(
title: "Testing Terms",
groups: ("Testing",),
theme: theme-chicago-index,
)
== Hardware group
#glossary(title: "Hardware Terms", groups: ("Hardware",), theme: theme-chicago-index)
#glossary(
title: "Hardware Terms",
groups: ("Hardware",),
theme: theme-chicago-index,
)
== Unreferenced entries
#glossary(title: "Unreferenced (Should Contain Unused?)", groups: ("Security",), theme: theme-chicago-index)
#glossary(
title: "Unreferenced (Should Contain Unused?)",
groups: ("Security",),
theme: theme-chicago-index,
)
== Empty group glossary
#glossary(title: "Empty Group Glossary", groups: (""), theme: theme-basic)
#glossary(title: "Empty Group Glossary", groups: "", theme: theme-basic)
= End of Brutal Test
Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 KiB

After

Width:  |  Height:  |  Size: 135 KiB

+16 -13
View File
@@ -2,14 +2,14 @@
// Our test glossary
#show: init-glossary.with((
ShortInHeader: "short used in header",
ShortInCaption: "short used in caption",
LongInHeader: "long used in header",
LongInCaption: "long used in caption",
BothInHeader: "both used in header",
BothInCaption: "both used in caption",
NormalInHeader: "unmodified use in header",
NormalInCaption: "unmodified use in caption",
ShortInHeader: "short used in header",
ShortInCaption: "short used in caption",
LongInHeader: "long used in header",
LongInCaption: "long used in caption",
BothInHeader: "both used in header",
BothInCaption: "both used in caption",
NormalInHeader: "unmodified use in header",
NormalInCaption: "unmodified use in caption",
))
// Configure styling
@@ -21,11 +21,11 @@
// Outlines
#outline(title:"Table of Contents", indent: auto)
#outline(title: "Table of Contents", indent: auto)
#outline(title: "List of Figures", target: figure.where(kind: image))
#block(
height:7em,
glossary(title: "List of Abbreviations", theme: theme-twocol)
height: 7em,
glossary(title: "List of Abbreviations", theme: theme-twocol),
)
#line(length: 100%)
@@ -37,7 +37,7 @@
=== `@ShortInHeader:short` = "@ShortInHeader:short"
=== `@LongInHeader:long` = "@LongInHeader:long"
=== `@BothInHeader:both` = "@BothInHeader:both"
=== `@BothInHeader:both:nouse` = "@BothInHeader:both:nouse"
=== `@NormalInHeader` = "@NormalInHeader"
#line(length: 100%)
@@ -47,7 +47,10 @@
#figure([], caption: [`@ShortInCaption:short` = "@ShortInCaption:short"])
#figure([], caption: [`@LongInCaption:long` = "@LongInCaption:long"])
#figure([], caption: [`@BothInCaption:both` = "@BothInCaption:both"])
#figure(
[],
caption: [`@BothInCaption:both:nospend` = "@BothInCaption:both:nospend"],
)
#figure([], caption: [`@NormalInCaption` = "@NormalInCaption"])
#line(length: 100%)
+4 -4
View File
@@ -2,7 +2,7 @@
#show: init-glossary.with((
one: "this is term one",
two: "term two also"
two: "term two also",
))
#set page(
@@ -19,15 +19,15 @@ shown anyway.
#glossary(
theme: theme-chicago-index,
show-all: true
show-all: true,
)
#glossary(
theme: theme-compact,
show-all: true
show-all: true,
)
#glossary(
theme: theme-table,
show-all: true
show-all: true,
)
+2 -2
View File
@@ -22,11 +22,11 @@
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"
description: "A document on how to run all the test procedures",
),
)
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
#show: init-glossary.with(myGlossary, show-term: body => [#emph(body)])
#set page(numbering: "1")
+6 -6
View File
@@ -8,7 +8,7 @@
),
iphone: (
short: "iPhone",
description: "Revolutionized phones."
description: "Revolutionized phones.",
),
css: (
short: "CSS",
@@ -21,11 +21,11 @@
tps: (
short: "TPS",
long: "test procedure specification",
description: "A document on how to run all the test procedures"
description: "A document on how to run all the test procedures",
),
)
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
#show: init-glossary.with(myGlossary, show-term: body => [#emph(body)])
#set page(
margin: 1cm,
@@ -35,7 +35,7 @@
#text(size: 24pt, weight: "bold")[`glossy`: theme gallery]
#text(size: 1pt, fill: rgb(0,0,0,0))[
#text(size: 1pt, fill: rgb(0, 0, 0, 0))[
First, we refer to each term at least once so they'll actually show up in the
glossaries. Our terms include: @atom, @iphone, @html:cap, @css, and @tps.
]
@@ -48,8 +48,8 @@
width: 100%,
spacing: 2em,
inset: 1em,
stroke: 1pt+gray,
stroke: 1pt + gray,
height: if theme.first() == "theme-twocol" { 1.5in } else { auto },
glossary(title: raw(theme.first()), theme: theme.last(), ignore-case: true)
glossary(title: raw(theme.first()), theme: theme.last(), ignore-case: true),
)
}
+1 -1
View File
@@ -1,4 +1,4 @@
#import "/lib.typ":*
#import "/lib.typ": *
#set text(lang: "cs", region: "CZ")