Names & styling on models

This commit is contained in:
Dandaedre 2026-08-15 16:50:07 +02:00
parent 90d03a3881
commit da97d98545
1 changed files with 90 additions and 13 deletions

View File

@ -215,21 +215,96 @@
// ---------------------------------------------------------------------------
show: make-glossary
// show ref: it => {
// let head = heading
// let el = it.element
// if el != none and el.func() == heading {
// // Override heading references.
// text(fill: red)[#link(el.location())[#it: #el.body]]
// } else if el != none and el.func() == figure and el.kind == "glossarium_entry" {
// smallcaps(it)
// } else {
// // Other references as usual.
// it
// }
// }
register-glossary(glossary)
show ref: it => {
let el = it.element
if el != none and el.func() == figure and el.kind == "glossarium_entry" {
text(fill: theme.blood, it)
} else {
it
}
}
let print-glossary-entry(entry, backrefs: (), ..) = {
let show-pages = backrefs.len() < 10
block(
width: 100%,
above: 0.9em,
below: 0.9em,
)[
// -------------------------------------------------------------------------
// Heading
// -------------------------------------------------------------------------
#let capitalize(s) = {
if type(s) == str{
let clustr = s.clusters()
if clustr.len() < 2 {
s
} else {
upper(clustr.at(0)) + clustr.slice(1).join()
}
} else {
s
}
}
#if entry.long != none [
#h(0.45em) #text(
size: 1.05em,
weight: "semibold",
fill: theme.blood,
)[
#capitalize(entry.long)
]
] #if entry.short != none{ text(
size: 0.9em,
weight: "regular",
fill: theme.muted,
style: "italic",
)[( #capitalize(entry.short) )] }
// -------------------------------------------------------------------------
// Definition
// -------------------------------------------------------------------------
#v(-0.10em)
#if entry.description != none [
#par(
justify: true,
// leading: 0.62em,
)[
#entry.description
]
]
// -------------------------------------------------------------------------
// Backreferences
// -------------------------------------------------------------------------
#if show-pages and backrefs.len() > 0 [
#align(right)[
#text(
size: 0.72em,
fill: theme.muted,
)[
#backrefs.join(" · ")
]
]
]
// -------------------------------------------------------------------------
// Entry separator
// -------------------------------------------------------------------------
#v(0.7em)
]
} // -----------------------------------------------------------------------------
// Glossary
// -----------------------------------------------------------------------------
document
[= Glossaire]
@ -244,5 +319,7 @@
"long",
),
show-all: true,
user-print-gloss: print-glossary-entry,
)
}