feat(glossy): add new themes, update tests, README
This commit is contained in:
6 files changed
+114
-5
No files matched your search
@@ -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]
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
},
|
||||
)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 384 KiB After Width: | Height: | Size: 521 KiB |
@@ -27,22 +27,32 @@
|
||||
|
||||
#show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)])
|
||||
|
||||
#text(size: 18pt, weight: "bold")[Theme Gallery]
|
||||
#set page(
|
||||
margin: 1cm,
|
||||
height: auto,
|
||||
)
|
||||
|
||||
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.
|
||||
#text(size: 24pt, weight: "bold")[`glossy`: theme gallery]
|
||||
|
||||
#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.
|
||||
]
|
||||
#v(-2em)
|
||||
|
||||
// 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-academic", theme-academic),
|
||||
("theme-basic", theme-basic),
|
||||
("theme-chicago-index", theme-chicago-index),
|
||||
("theme-compact", theme-compact),
|
||||
)
|
||||
|
||||
#for theme in themes {
|
||||
block(
|
||||
breakable: false,
|
||||
width: 100%,
|
||||
spacing: 2em,
|
||||
inset: 1em,
|
||||
stroke: 1pt+gray,
|
||||
@@ -53,7 +63,7 @@ glossaries. Our terms include: @atom, @iphone, @html:cap, @css, and @tps.
|
||||
// HACK: special case theme-twocol so we can restrict the height
|
||||
#block(
|
||||
breakable: false,
|
||||
spacing: 2em,
|
||||
spacing: 1em,
|
||||
inset: 1em,
|
||||
stroke: 1pt+gray,
|
||||
height: 1.5in,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 521 KiB |
Reference in new issue
Block a user