249 lines
4.5 KiB
Plaintext
249 lines
4.5 KiB
Plaintext
// ----- IMPORTS -----
|
|
#import "@preview/glossarium:0.5.10": gls, glspl, make-glossary, print-glossary, register-glossary
|
|
|
|
// Setup glossaries
|
|
#import "glossary.typ": glossary
|
|
#import "school_model.typ" as model
|
|
|
|
// Re-export models
|
|
#let school_presentation = model.school_presentation
|
|
|
|
#let model(
|
|
variables,
|
|
document,
|
|
theme,
|
|
theme-var,
|
|
) = {
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Page & typography
|
|
// ---------------------------------------------------------------------------
|
|
|
|
set page(
|
|
paper: "a4",
|
|
margin: (
|
|
top: 2.2cm,
|
|
bottom: 2.4cm,
|
|
left: 2.5cm,
|
|
right: 2.5cm,
|
|
),
|
|
numbering: "1",
|
|
)
|
|
|
|
set text(
|
|
font: "Libertinus Serif",
|
|
size: 11pt,
|
|
lang: "fr",
|
|
fill: theme.ink,
|
|
)
|
|
|
|
set par(
|
|
justify: true,
|
|
leading: 0.7em,
|
|
first-line-indent: 1em,
|
|
spacing: 0.9em,
|
|
)
|
|
|
|
// Theme controls heading numbering.
|
|
set heading(
|
|
numbering: theme-var("heading-numbering"),
|
|
)
|
|
// ---------------------------------------------------------------------------
|
|
// Heading helpers
|
|
// ---------------------------------------------------------------------------
|
|
|
|
let heading-number(it) = {
|
|
if it.level == 1 or it.numbering == none {
|
|
none
|
|
} else {
|
|
counter(heading).display(it.numbering)
|
|
}
|
|
}
|
|
|
|
let heading-number-content(it) = {
|
|
let number = heading-number(it)
|
|
|
|
if number == none {
|
|
[]
|
|
} else {
|
|
text(
|
|
weight: "bold",
|
|
fill: theme.heading,
|
|
)[
|
|
#number #h(0.45em)
|
|
]
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Headings
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Level 1 — Major section
|
|
show heading.where(level: 1): set align(center)
|
|
|
|
show heading.where(level: 1): it => block(
|
|
above: 2em,
|
|
below: 1.2em,
|
|
)[
|
|
#text(
|
|
font: "Libertinus Serif",
|
|
size: 22pt,
|
|
weight: "bold",
|
|
fill: theme.heading,
|
|
)[
|
|
#it.body
|
|
]
|
|
|
|
#stack(
|
|
dir: ltr,
|
|
spacing: 0.4em,
|
|
|
|
[
|
|
#box(
|
|
width: 1.5cm,
|
|
height: 0.5pt,
|
|
fill: theme.heading-accent,
|
|
)
|
|
],
|
|
|
|
[
|
|
#text(
|
|
size: 7pt,
|
|
fill: theme.heading-accent,
|
|
)[
|
|
#theme-var("section-symbol")
|
|
]
|
|
],
|
|
|
|
[
|
|
#box(
|
|
width: 1.5cm,
|
|
height: 0.5pt,
|
|
fill: theme.heading-accent,
|
|
)
|
|
],
|
|
)
|
|
]
|
|
|
|
// Level 2 — Section
|
|
show heading.where(level: 2): it => block(
|
|
above: 1.5em,
|
|
below: 0.7em,
|
|
)[
|
|
#text(
|
|
size: 16pt,
|
|
weight: "bold",
|
|
fill: theme.heading,
|
|
)[
|
|
#heading-number-content(it) #it.body
|
|
]
|
|
]
|
|
|
|
// Level 3 — Subsection
|
|
show heading.where(level: 3): it => block(
|
|
above: 1em,
|
|
below: 0.4em,
|
|
)[
|
|
#text(
|
|
size: 12pt,
|
|
weight: "bold",
|
|
fill: theme.heading-accent,
|
|
)[
|
|
#heading-number-content(it) #it.body
|
|
]
|
|
]
|
|
|
|
// Level 4 — Minor subsection
|
|
show heading.where(level: 4): it => block(
|
|
above: 0.8em,
|
|
below: 0.3em,
|
|
)[
|
|
#text(
|
|
size: 11pt,
|
|
weight: "bold",
|
|
fill: theme.heading-subtle,
|
|
)[
|
|
#heading-number-content(it) #it.body
|
|
]
|
|
]
|
|
|
|
// Level 5 — Smallest heading
|
|
show heading.where(level: 5): it => block(
|
|
above: 0.6em,
|
|
below: 0.2em,
|
|
)[
|
|
#text(
|
|
size: 10pt,
|
|
weight: "bold",
|
|
fill: theme.heading-subtle,
|
|
)[
|
|
#heading-number-content(it) #it.body
|
|
]
|
|
]
|
|
// ---------------------------------------------------------------------------
|
|
// Inline formatting
|
|
// ---------------------------------------------------------------------------
|
|
|
|
show strong: it => text(
|
|
weight: "bold",
|
|
fill: theme.emphasis,
|
|
)[
|
|
#it
|
|
]
|
|
|
|
show emph: it => text(
|
|
style: "italic",
|
|
)[
|
|
#it
|
|
]
|
|
|
|
show link: set text(
|
|
fill: theme.link,
|
|
)
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Tables
|
|
// ---------------------------------------------------------------------------
|
|
|
|
set table(
|
|
stroke: 0.5pt + theme.border,
|
|
)
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Glossary
|
|
// ---------------------------------------------------------------------------
|
|
|
|
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)
|
|
|
|
document
|
|
|
|
[= Glossaire]
|
|
print-glossary(
|
|
glossary,
|
|
entry-sortkey: x => x.long,
|
|
shorthands: (
|
|
"plural",
|
|
"capitalize",
|
|
"capitalize-plural",
|
|
"short",
|
|
"long",
|
|
),
|
|
show-all: true,
|
|
)
|
|
}
|