feat(glossy): add new themes, update tests, README

This commit is contained in:
swaits committed 2024-12-05 01:08:43 +01:00
1 parent db46a5e025
commit 73348abeaf
6 files changed
+114 -5

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
#import "themes/academic.typ": theme-academic
#import "themes/basic.typ": theme-basic
#import "themes/chicago-index.typ": theme-chicago-index
#import "themes/compact.typ": theme-compact
#import "themes/twocol.typ": theme-twocol
@@ -0,0 +1,50 @@
// Inspired by academic textbook glossaries
#let theme-academic = (
section: (title, body) => {
set text(font: "New Computer Modern")
heading(level: 1, title)
v(1em)
body
},
group: (name, index, total, body) => {
if name != "" and total > 1 {
v(1.5em)
align(left, text(weight: "bold", size: 1.2em, name))
v(0.75em)
line(length: 100%, stroke: 0.5pt)
v(0.75em)
}
body
},
entry: (entry, index, total) => {
let short-display = text(weight: "bold", entry.short)
let long-display = if entry.long == none {
[]
} else {
[. #entry.long]
}
let description = if entry.description == none {
[]
} else {
[. #entry.description]
}
block(
below: 1em,
text(
size: 0.95em,
{
grid(
columns: (1fr, auto),
gutter: 0.75em,
[#short-display#long-display#description],
text(fill: rgb("#666666"), entry.pages)
)
}
)
)
},
)
@@ -0,0 +1,47 @@
// Inspired by the Chicago Manual of Style's index format
#let theme-chicago-index = (
section: (title, body) => {
set par(hanging-indent: 1em)
heading(level: 1, smallcaps(title))
body
},
group: (name, index, total, body) => {
if name != "" and total > 1 {
v(1em)
text(weight: "medium", style: "italic", name)
v(0.5em)
}
body
},
entry: (entry, index, total) => {
let short-display = text(weight: "regular", entry.short)
let long-display = if entry.long == none {
[]
} else {
[ — #entry.long] // Using em-dash for Chicago style
}
let description = if entry.description == none {
[]
} else {
text(style: "italic", [: #entry.description])
}
block(
below: 0.65em,
text(
size: 0.9em,
{
grid(
columns: (1fr, auto),
gutter: 1em,
[#short-display#entry.label#long-display#description],
[#entry.pages]
)
}
)
)
},
)