Changed comment styling
This commit is contained in:
parent
fb2be3c94a
commit
01fd9bf921
113
setup/model.typ
113
setup/model.typ
|
|
@ -1,28 +1,26 @@
|
|||
// ----- Glossary engine and class presentation model -----
|
||||
// Glossary engine and class presentation model
|
||||
#import "@preview/glossarium:0.5.10": (
|
||||
get-entry-back-references, gls, gls-description, glspl, make-glossary,
|
||||
print-glossary, register-glossary,
|
||||
)
|
||||
|
||||
// ----- Load project glossaries and presentation model -----
|
||||
// Load project glossaries and presentation model
|
||||
#import "glossary.typ": glossary
|
||||
#import "school_model.typ" as model
|
||||
|
||||
// ----- Re-export commonly used model functions -----
|
||||
// Re-export commonly used model functions
|
||||
#let gls = gls
|
||||
#let gls-description = gls-description
|
||||
#let school_presentation = model.school_presentation
|
||||
|
||||
// ----- Configure the main document model -----
|
||||
// Configure the main document model
|
||||
#let model(
|
||||
variables,
|
||||
document,
|
||||
theme,
|
||||
theme-var,
|
||||
) = {
|
||||
// ===========================================================================
|
||||
// ----- Page and typography -----
|
||||
// ===========================================================================
|
||||
// ----- PAGE AND TYPOGRAPHY -----
|
||||
|
||||
set page(
|
||||
paper: "a4",
|
||||
|
|
@ -49,16 +47,14 @@
|
|||
spacing: 0.9em,
|
||||
)
|
||||
|
||||
// ----- Use the theme's heading numbering configuration -----
|
||||
// Use the theme's heading numbering configuration
|
||||
set heading(
|
||||
numbering: theme-var("heading-numbering"),
|
||||
)
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Heading helpers -----
|
||||
// ===========================================================================
|
||||
// ----- HEADING HELPERS -----
|
||||
|
||||
// ----- Return a heading's displayed number, except for level 1 -----
|
||||
// Return a heading's displayed number, except for level 1
|
||||
let heading-number(it) = {
|
||||
if it.level == 1 or it.numbering == none {
|
||||
none
|
||||
|
|
@ -67,7 +63,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// ----- Render a heading number using the theme's heading color -----
|
||||
// Render a heading number using the theme's heading color
|
||||
let heading-number-content(it) = {
|
||||
let number = heading-number(it)
|
||||
|
||||
|
|
@ -83,11 +79,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Headings -----
|
||||
// ===========================================================================
|
||||
// ----- HEADINGS -----
|
||||
|
||||
// ----- Level 1: major section -----
|
||||
// Level 1: major section
|
||||
show heading.where(level: 1): set align(center)
|
||||
|
||||
show heading.where(level: 1): it => block(
|
||||
|
|
@ -107,7 +101,7 @@
|
|||
dir: ltr,
|
||||
spacing: 0.4em,
|
||||
|
||||
// ----- Decorative rule -----
|
||||
// Decorative rule
|
||||
[
|
||||
#box(
|
||||
width: 1.5cm,
|
||||
|
|
@ -116,7 +110,7 @@
|
|||
)
|
||||
],
|
||||
|
||||
// ----- Theme section symbol -----
|
||||
// Theme section symbol
|
||||
[
|
||||
#text(
|
||||
size: 7pt,
|
||||
|
|
@ -127,7 +121,7 @@
|
|||
]
|
||||
],
|
||||
|
||||
// ----- Decorative rule -----
|
||||
// Decorative rule
|
||||
[
|
||||
#box(
|
||||
width: 1.5cm,
|
||||
|
|
@ -138,7 +132,7 @@
|
|||
)
|
||||
]
|
||||
|
||||
// ----- Level 2: section -----
|
||||
// Level 2: section
|
||||
show heading.where(level: 2): it => block(
|
||||
above: 1.5em,
|
||||
below: 0.7em,
|
||||
|
|
@ -152,7 +146,7 @@
|
|||
]
|
||||
]
|
||||
|
||||
// ----- Level 3: subsection -----
|
||||
// Level 3: subsection
|
||||
show heading.where(level: 3): it => block(
|
||||
above: 1em,
|
||||
below: 0.4em,
|
||||
|
|
@ -166,7 +160,7 @@
|
|||
]
|
||||
]
|
||||
|
||||
// ----- Level 4: minor subsection -----
|
||||
// Level 4: minor subsection
|
||||
show heading.where(level: 4): it => block(
|
||||
above: 0.8em,
|
||||
below: 0.3em,
|
||||
|
|
@ -180,7 +174,7 @@
|
|||
]
|
||||
]
|
||||
|
||||
// ----- Level 5: smallest heading -----
|
||||
// Level 5: smallest heading
|
||||
show heading.where(level: 5): it => block(
|
||||
above: 0.6em,
|
||||
below: 0.2em,
|
||||
|
|
@ -194,11 +188,9 @@
|
|||
]
|
||||
]
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Inline formatting -----
|
||||
// ===========================================================================
|
||||
// ----- INLINE FORMATTING -----
|
||||
|
||||
// ----- Style strong emphasis using the theme -----
|
||||
// Style strong emphasis using the theme
|
||||
show strong: it => text(
|
||||
weight: "bold",
|
||||
fill: theme.emphasis,
|
||||
|
|
@ -206,7 +198,7 @@
|
|||
#it
|
||||
]
|
||||
|
||||
// ----- Preserve italic emphasis -----
|
||||
// Preserve italic emphasis
|
||||
// show emph: it =>
|
||||
// text(
|
||||
// style: "italic",
|
||||
|
|
@ -214,29 +206,30 @@
|
|||
// #it
|
||||
// ]
|
||||
|
||||
// ----- Apply the theme's link color -----
|
||||
// Apply the theme's link color
|
||||
show link: set text(
|
||||
fill: theme.link,
|
||||
)
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Tables -----
|
||||
// ===========================================================================
|
||||
|
||||
// ----- KEY TERMS -----
|
||||
|
||||
// ----- Apply the theme's default table border -----
|
||||
|
||||
|
||||
// ----- TABLES -----
|
||||
|
||||
// Apply the theme's default table border
|
||||
set table(
|
||||
stroke: 0.5pt + theme.border,
|
||||
)
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Glossary setup -----
|
||||
// ===========================================================================
|
||||
// ----- GLOSSARY SETUP -----
|
||||
|
||||
// ----- Enable glossary rendering and register project entries -----
|
||||
// Enable glossary rendering and register project entries
|
||||
show: make-glossary
|
||||
register-glossary(glossary)
|
||||
|
||||
// ----- Color references to glossary entries -----
|
||||
// Color references to glossary entries
|
||||
show ref: it => {
|
||||
let el = it.element
|
||||
|
||||
|
|
@ -247,13 +240,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Glossary entry renderer -----
|
||||
// ===========================================================================
|
||||
// ----- GLOSSARY ENTRY RENDERER -----
|
||||
|
||||
// ----- Render an individual glossary entry as a themed card -----
|
||||
// Render an individual glossary entry as a themed card
|
||||
let print-glossary-entry(entry, ..) = {
|
||||
// ----- Capitalize the first grapheme of a string -----
|
||||
// Capitalize the first grapheme of a string
|
||||
let capitalize(s) = {
|
||||
if type(s) == str {
|
||||
let clusters = s.clusters()
|
||||
|
|
@ -267,13 +258,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
// ----- Retrieve unique back-references to the entry -----
|
||||
// Retrieve unique back-references to the entry
|
||||
let refs = get-entry-back-references(
|
||||
entry,
|
||||
deduplicate: true,
|
||||
)
|
||||
|
||||
// ----- Detect optional custom entry features -----
|
||||
// Detect optional custom entry features
|
||||
let has-icon = (
|
||||
entry.custom != none
|
||||
and "icon" in entry.custom
|
||||
|
|
@ -281,9 +272,7 @@
|
|||
)
|
||||
let has-alts = entry.custom != none and "alts" in entry.custom
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ----- Glossary card -----
|
||||
// -------------------------------------------------------------------------
|
||||
// ----- GLOSSARY CARD -----
|
||||
|
||||
block(
|
||||
width: 100%,
|
||||
|
|
@ -305,9 +294,7 @@
|
|||
),
|
||||
)[
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// ----- Entry header -----
|
||||
// -----------------------------------------------------------------------
|
||||
// ----- ENTRY HEADER -----
|
||||
|
||||
#grid(
|
||||
columns: (
|
||||
|
|
@ -318,7 +305,7 @@
|
|||
gutter: 0.6em,
|
||||
align: (center, horizon, center),
|
||||
|
||||
// ----- Optional entry icon -----
|
||||
// Optional entry icon
|
||||
if has-icon [
|
||||
#box(
|
||||
width: 1.8em,
|
||||
|
|
@ -331,7 +318,7 @@
|
|||
)
|
||||
] else [],
|
||||
|
||||
// ----- Entry name and short form -----
|
||||
// Entry name and short form
|
||||
[
|
||||
#text(
|
||||
size: 1.08em,
|
||||
|
|
@ -357,15 +344,13 @@
|
|||
]
|
||||
],
|
||||
|
||||
// ----- Reserved space for optional back-references -----
|
||||
// Reserved space for optional back-references
|
||||
// if refs.len() > 0 and refs.len() < 5 [
|
||||
// ...
|
||||
// ] else [],
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// ----- Entry description -----
|
||||
// -----------------------------------------------------------------------
|
||||
// ----- ENTRY DESCRIPTION -----
|
||||
|
||||
#if entry.description != none [
|
||||
#block(
|
||||
|
|
@ -385,9 +370,7 @@
|
|||
]
|
||||
]
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// ----- Alternative names -----
|
||||
// -----------------------------------------------------------------------
|
||||
// ----- ALTERNATIVE NAMES -----
|
||||
|
||||
#if has-alts [
|
||||
#v(0.55em)
|
||||
|
|
@ -426,14 +409,12 @@
|
|||
]
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ----- Document and glossary -----
|
||||
// ===========================================================================
|
||||
// ----- DOCUMENT AND GLOSSARY -----
|
||||
|
||||
// ----- Render the main document content -----
|
||||
// Render the main document content
|
||||
document
|
||||
|
||||
// ----- Append the complete glossary -----
|
||||
// Append the complete glossary
|
||||
[= Glossaire]
|
||||
set par(
|
||||
first-line-indent: 0pt,
|
||||
|
|
|
|||
Loading…
Reference in New Issue